Multi module Maven Project dependency issue? - eclipse

I have a multi module project where common-project is depend on another 3rdparty project and below is the pom.xml of common-project
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.tri.iss.pet.common</groupId>
<version>0.0.1-SNAPSHOT</version>
<artifactId>common-um-entities</artifactId>
<name>common-um-entities</name>
<description>Common UM Entities</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<fork>true</fork>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.tri.iss.pet.common</groupId>
<artifactId>3rdparty</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>jar</type>
</dependency>
</dependencies>
</project>
As you clearly check i have added dependency in pom.xml file but check below image its saying jar missing
Can someone tell me why only project dependency not able to load while other dependency which coming from Artifactory working fine ?
Note:- Dont be confuse from project name .

Related

Problems building effective model for com.MyProject:jar:1.0-SNAPSHOT

My project already runs correctly inside netbeans, but when I want to do "clean and compile" to create the .jar file, it doesn't create the "dist" folder but a "target" folder and doesn't even execute the file, in Console I get It shows some meven errors and the pom file that I still don't know how to fix. I hope someone can guide me in this final step of my project. I leave the capture and the code of the pom file.
error 1
error 2
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany</groupId>
<artifactId>Compugar1</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<showDeprecation>false</showDeprecation>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>unknown-jars-temp-repo</id>
<name>A temporary repository created by NetBeans for libraries and jars it could not identify. Please replace the dependencies in this repository with correct ones and delete this repository.</name>
<url>file:${project.basedir}/lib</url>
</repository>
</repositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.formdev</groupId>
<artifactId>flatlaf</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>com.formdev</groupId>
<artifactId>flatlaf-intellij-themes</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>unknown.binary</groupId>
<artifactId>AbsoluteLayout</artifactId>
<version>SNAPSHOT</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.22</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-text</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>config/sun_checks.xml</configLocation>
</configuration>
</plugin>
</plugins>
</reporting>
<name>Compugar</name>
<description>Base de datos de clientes, antenas, reportes y pagos</description>
</project>
I tried to delete the dependencies and download them again, but it didn't work...

JFXtras ClassNotFoundException on maven build

I am using Eclipse with the Maven integration and included JFXtras in my project. When I do the maven build, it successfully creates the jar, but when I try to run it, I get a
java.lang.ClassNotFoundException: jfxtras.scene.control.ListSpinner
I integrated jfxtras like described here:
http://mvnrepository.com/artifact/org.jfxtras/jfxtras-labs/8.0-r3
Edit:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>propgr</groupId>
<artifactId>Project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.jfxtras</groupId>
<artifactId>jfxtras-labs</artifactId>
<version>8.0-r1</version>
</dependency>
<dependency>
<groupId>org.jfxtras</groupId>
<artifactId>jfxtras-controls</artifactId>
<version>8.0-r1</version>
</dependency>
<dependency>
<groupId>org.jfxtras</groupId>
<artifactId>jfxtras-common</artifactId>
<version>8.0-r1</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>main.Main</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Any ideas / help?
JFXtras consist of a number of artifact; labs, controls, common, ..., with some dependencies between them. The dependency for labs is missing. The pom below works for me.
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>propgr</groupId>
<artifactId>Project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.jfxtras</groupId>
<artifactId>jfxtras-labs</artifactId>
<version>8.0-r3</version>
</dependency>
</dependencies>
<build>
...
</build>
</project>
That is for a release, if you want to use a snapshot, you need to add the Sonatype snapshot repository in the pom or .m2/settings.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>propgr</groupId>
<artifactId>Project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.jfxtras</groupId>
<artifactId>jfxtras-labs</artifactId>
<version>8.0-r4-SNAPSHOT</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>oss-sonatype</id>
<name>oss-sonatype</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<build>
...
</build>
</project>

How to deploy ear into WildFly 8.0 via eclipse IDE

I have installed the JBoss AS tools in my eclipse. Then I have created an WildFly 8.0 server. I have parent project pom.xml like below:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.company</groupId>
<artifactId>trx-server-parent</artifactId>
<version>1.0.0</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java-version>1.7</java-version>
<javaee-api-version>7.0</javaee-api-version>
</properties>
<modules>
<module>trx-server-ear</module>
<module>trx-server-domain</module>
<module>trx-server-services</module>
<module>trx-server-web</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>${javaee-api-version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<!-- compiler plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>${java-version}</source>
<target>${java-version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.5</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
<version>2.4</version>
<configuration>
<ejbVersion>3.2</ejbVersion>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>2.9.1</version>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
And ear project pom.xml is like:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.company</groupId>
<artifactId>trx-server-parent</artifactId>
<version>1.0.0</version>
</parent>
<artifactId>trx-server-ear</artifactId>
<packaging>ear</packaging>
<dependencies>
<dependency>
<groupId>com.company</groupId>
<artifactId>trx-server-web</artifactId>
<version>${project.version}</version>
<type>war</type>
</dependency>
<dependency>
<groupId>com.company</groupId>
<artifactId>trx-server-services</artifactId>
<version>${project.version}</version>
<type>ejb</type>
</dependency>
</dependencies>
<build>
<finalName>trx-server</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<finalName>trx-server</finalName>
<version>7</version>
<defaultJavaBundleDir>lib/</defaultJavaBundleDir>
<modules>
<webModule>
<groupId>com.company</groupId>
<artifactId>trx-server-web</artifactId>
<contextRoot>/trx-server-web</contextRoot>
</webModule>
<ejbModule>
<groupId>com.company</groupId>
<artifactId>trx-server-services</artifactId>
</ejbModule>
</modules>
</configuration>
</plugin>
</plugins>
</build>
</project>
I defined the trx-server-domain module as jar file and packaged into the lib folder. When run mvn clean install on my parent pom.xml, I got an ear file named trx-server.ear. Then the trx-server.ear file structure is like:
-- trx-server
-- lib
-- trx-server-domain-1.0.0.jar
-- trx-server-services-1.0.0.jar
-- trx-server-web-1.0.0.war
I can deploy this ear file to WildFly server manually (via web management page). Everything is fine for that.
My problem is when I deploy some changes via Eclipse, I mean via the server adapter. The root web contextRoot is not what I defined in the ear project pom.xml file. And the trx-server-domain will be deploy as EJB which should be a jar file under lib folder.
I got a trx-server-ear.ear folder in the WildFly deployments directory which is not what I wanted. The structures of this folder is:
trx-server-ear.ear
-- trx-server-domain-1.0.0.jar
-- trx-server-services-1.0.0.jar
-- trx-server-web-1.0.0.war
No lib folder and all jar/war files are in same level.
The problem only exist when I deploy the ear in the Eclipse. Is there any other plungin I should install?
Anyone could give me example of how to configure the ear with multiple modules?

Changing maven build output directory for .jar (has dependencies)

I'm setting up eclipse again to make plugins for bukkit, which is an API that i depend on. Also i want to move the .jar the build process creates to a directory of my choice.
http://wiki.bukkit.org/Plugin_Tutorial#Commands (makes the pom.xml below)
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>MY_PACKAGE_NAME</groupId>
<artifactId>MY_PLUGIN_NAME</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>bukkit-repo</id>
<url>http://repo.bukkit.org/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
<version>1.7.9-R0.2</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
Current output:
$project_root/target/MY_PLUGIN_NAME-0.0.1-SNAPSHOT.jar
Desired output:
C:/my/output/directory/MY_PLUGIN_NAME-0.0.1-SNAPSHOT.jar
You can use following configuration under <build> tag:
<outputDirectory>C:/my/output/directory</outputDirectory>
tip / warning : Although this will work but keeping your packaging outside target is discouraged. Its not maven standard. Rethink before doing it.

Maven GWT (SmartGWT): How to organize my project to prevent long compilation

Dear StackOverflow Users,
I want to split my huge application written in SmartGWT, compiled by maven, into several subprojects, for example: common, custom-widgets, forms, custom-datasources, sites.
The main idea is: once subproject is compilated by GWT can be easy used in other sub-project to skip compilation again. (sorry for my english, but I think You got my point)
example subproject pom.xml is:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>eu.nanobeauty</groupId>
<artifactId>nanobeauty</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>common</artifactId>
<packaging>jar</packaging>
<name>nanoBeauty :: Common</name>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwt.version}</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Common.gwt.xml is :
<module>
<inherits name="com.google.gwt.user.User"/>
<inherits name="com.smartgwt.SmartGwtNoTheme"/>
<source path="common"/>
</module>
and the parent pom.xml is:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>eu.nanobeauty</groupId>
<artifactId>nanobeauty</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>nanoBeauty :: Parent</name>
<modules>
<module>datasources</module>
<!-- multimodule : each form different project -->
<module>forms</module>
<!-- multimodule : each site different project -->
<module>sites</module>
<module>common</module>
</modules>
<properties>
<gwt.version>2.5.0</gwt.version>
<smartgwt.version>3.1</smartgwt.version>
<java.version>1.6</java.version>
<webappDirectory>${project.build.directory}/${project.build.finalName}</webappDirectory>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.war.plugin.version>2.1.1</maven.war.plugin.version>
</properties>
<repositories>
<repository>
<id>smartclient</id>
<url>http://smartclient.com/maven2</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.smartgwt</groupId>
<artifactId>smartgwt</artifactId>
<version>${smartgwt.version}</version>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>${gwt.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>${gwt.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
After long night googling i found solution:
It cannot be done this way I want to achieve.
GWT needs source files to generate JS files. Main module pom.xml is ok and example .gwt.xml file above is also ok. Only change is in sub-module pom.xml files only goal is resources.
So for every submodule I need to setup pom.xml that looks like similar to:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>eu.nanobeauty</groupId>
<artifactId>nanobeauty</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<artifactId>common</artifactId>
<packaging>jar</packaging>
<name>nanoBeauty :: Common</name>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>gwt-maven-plugin</artifactId>
<version>${gwt.version}</version>
<executions>
<execution>
<goals>
<goal>resources</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Based on this documents:
Resources goal
Multimodule project