Maven Multi-module: Submodule as dependencies - java

I have a multi-module project in maven and I created a main sub-module(which means that this sub-module has the main class). I add the other sub-modules into the main the sub-module(which is Submodule-0) as dependencies:
<dependencies>
<dependency>
<groupId>ProjectGroupId</groupId>
<artifactId>Submodule-1</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ProjectGroupId</groupId>
<artifactId>Submodule-2</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ProjectGroupId</groupId>
<artifactId>Submodule-3</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
I have Artifactory in my LAN and my maven settings.xml is configured to connect into the local Artifactory. In the PC where I installed the Artifactory this setup works fine but when I ran the setup in another computer(my laptop) it can't find the sub-modules libraries but I can see it in the Dependencies section of the project using Netbeans.
The Error Generated is:
[ERROR] Failed to execute goal on project Submodule-0: Could not resolve dependencies for project ProjectGroupId:Submodule-0:jar:0.0.1: Failed to collect dependencies at ProjectGroupId:Submodule-1:jar:0.0.1: Failed to read artifact descriptor for ProjectGroupId:Submodule-1:jar:0.0.1: Failure to find ProjectGroupId:MultiModule:pom:0.0.1 in http://192.168.10.136:8081/artifactory/libs-release was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]
I hope you guys can help and if this is a duplicate question hope you guys can lead me in the right path.

Try to run a maven build with the goal "deploy" on the machine with Artifactory installed. With that the artifacts are uploaded to the Artifactory's repository and will be available for remote access.
Once you have a stable version you may want to take a look into the maven-release-stuff http://maven.apache.org/maven-release/maven-release-plugin/index.html
EDIT:
Did you copy the settings.xml to the other machine?

Related

Is it possible to get nd4j working on linux-arm system?

I'm trying to get a maven project built with an nd4j dependency on a linux ARM system.
Here's my current dependency in my pom.xml file
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-native-platform</artifactId>
<version>0.9.1</version>
<scope>test</scope>
</dependency>
Here is the error I'm getting when trying to do a maven install on my ARM system
Could not resolve dependencies for project com.test.test:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: org.nd4j:nd4j-native:jar:linux-arm:0.9.1, org.bytedeco.javacpp-presets:openblas:jar:linux-arm:0.2.19-1.3: Failure to find org.nd4j:nd4j-native:jar:linux-arm:0.9.1 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced

Maven pom.xml local dependency not Resolved

Using eclipse maven and java 1.7 I have designed two backends named webservice.staff.backend and webservice.webuser.backend .
Now There is another webservice which is written by some of our Senior Team Member, which is a another module for Project shared with me by git.
In this New Project in pom.xml there are two local project dependency have been added as Follows.
<dependency>
<groupId>webservice.staff.backend</groupId>
<artifactId>webservice.staff.backend</artifactId>
<version>1.0.0</version>
<classifier>classes</classifier>
<type>jar</type> //used jar but webservices packaging as a war
</dependency>
<dependency>
<groupId>webservice.webuser.backend</groupId>
<artifactId>webservice.webuser.backend</artifactId>
<version>1.0.0</version>
<classifier>classes</classifier>
<type>jar</type> // used jar but webservices packaging as a war
</dependency>
but these dependency is not resolved when I am just trying to perform Maven clean install. What I Found in my earlier webservice Projects are packaging as a WAR but here used as jar
Here is earlier Project packaging type in pom.xml.
<groupId>webservice.staff.backend</groupId>
<artifactId>webservice.staff.backend</artifactId>
<packaging>war</packaging> //packaged as war but used as jar??
<groupId>webservice.webuser.backend</groupId>
<artifactId>webservice.webuser.backend</artifactId>
<packaging>war</packaging> //packaged as war but used as jar in
/*I Have also Changed packaging as a jar and then clean Install
and try to build the New Project but error still the same. */
Error StackTrace
[ERROR] Failed to execute goal on project webservice.credit.backend: Could not resolve dependencies for project webservice.credit.backend:webservice.credit.backend:war:2.0.0: The following artifacts could not be resolved: webservice.staff.webservice.staff.backend:jar:classes:1.0.0, webservice.webuser.backend:webservice.webuser.backend:jar:classes:1.0.0: Failure to find webservice.staff.backend:webservice.staff.backend:jar:classes:1.0.0 in http://download.java.net/maven/2/ was cached in the local repository, resolution will not be reattempted until the update interval of Java.Net has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
Note :- I have tried so many ways and also so many answers on stackOverflowin this regard but no one gives me correct solution to that.
Please Help anybody to Resolve this.. Thanks.
Remove <classifier>classes</classifier>
<dependency>
<groupId>webservice.staff.backend</groupId>
<artifactId>webservice.staff.backend</artifactId>
<version>1.0.0</version>
<type>jar</type>
</dependency>
<dependency>
<groupId>webservice.webuser.backend</groupId>
<artifactId>webservice.webuser.backend</artifactId>
<version>1.0.0</version>
<type>jar</type>
</dependency>
pom will be same for both projects except packaging will be jar :
<groupId>webservice.staff.backend</groupId>
<artifactId>webservice.staff.backend</artifactId>
<packaging>jar</packaging>
<version>1.0.0</version>
<groupId>webservice.webuser.backend</groupId>
<artifactId>webservice.webuser.backend</artifactId>
<packaging>jar</packaging>
<version>1.0.0</version>
Make sure your settings.xml is like below :
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>${user.home}/.m2/repository</localRepository>
<interactiveMode>true</interactiveMode>
------
</settings>
I have uploaded sample here.
Finally !!!
Got the solution for this.
what i need to do during clean & install add extra param with mvn to export the class files. parameter ==> -Dattach.and.archive.classes=true to the mvn command.
mvn clean install -Dattach.and.archive.classes=true //added one extra param
// -Dattach.and.archive.classes=true solved my dependency Problem.
Note :- If you Defined in pom.xml Project packaging as war and want a jar as dependency in Your local maven Repository. Just put this extra Option with -Dattach.and.archive.classes=true with mvn.

I am working in camel (Servicemix 5.4.0) i am getting below error message for sql in pom

I am working in camel (Servicemix 5.4.0) i am getting below error message while compiling project using mvn install
com.microsoft.sqlserver:sqljdbc4:jar:4.0: Failure to find
com.microsoft.sqlserver:sqljdbc:jar:4.0.2206.100 in https://repo.maven.apache.or
g/maven2 was cached in the local repository, resolution will not be reattempted
until the update interval of central has elapsed or updates are forced
I think it might because of pom.xml dependency part.
I have given following dependency in pom.xml
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
<scope>runtime</scope>
</dependency>
Please Help me out
This driver is not in Maven standard repository.
You could download it, and add to you local repository with:
mvn install:install-file -Dfile=sqljdbc4.jar -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0 -Dpackaging=jar
Download link for the driver:
http://www.microsoft.com/en-us/download/details.aspx?id=11774

Maven dependency has no jar in the central repo and the maven build fails due to no artifact

I added this dependency to my pom.xml. When I build the project if creates this error.
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-sandbox-parent</artifactId>
<version>10</version>
</dependency>
Failed to execute goal on project core: Could not resolve dependencies for project com.name:core:jar:0.0.1-SNAPSHOT: Could not find artifact org.apache.commons:commons-sandbox-parent:jar:10 in central (http://repo1.maven.org/maven2) -> [Help 1]
When I follow this link to the central repo, I notice that there are no precompiled jar files the folder. The build process complains about no jar. All the other dependencies I use have precompiled jar files in them. How can I solve this and compile my project?
http://central.maven.org/maven2/org/apache/commons/commons-sandbox-parent/10/
This dependency is of type 'pom', not type 'jar'. It's mentioned in the 'packaging' tag in the pom file at http://central.maven.org/maven2/org/apache/commons/commons-sandbox-parent/10/commons-sandbox-parent-10.pom.
If no type is specified while declaring a dependency it assumes it to be 'jar'. You can specify the type 'pom' instead.
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-sandbox-parent</artifactId>
<version>10</version>
<type>pom</type>
</dependency>

Need help in Sonatype Nexus and EclipseLink Maven Repo Proxy

Had cracked my head for too long with this, so I really really need help from some experts out there who has a solution for this problem.
I have installed Sonatype Nexus ver 2.0.3 and I'm having it as my development repository for JavaEE, Glassfish kind of app and have configured maven settings.xml to read from the nexus repo. Every other jar was properly downloaded and cached but everytime when it comes to jars on org.eclipse.persistence.xxx, it failed with the result:
[WARNING] The POM for org.eclipse.persistence:eclipselink:jar:2.3.2 is missing, no dependency information available
[WARNING] The POM for org.eclipse.persistence:javax.persistence:jar:2.0.3 is missing, no dependency information available
[WARNING] The POM for org.eclipse.persistence:org.eclipse.persistence.jpa.modelgen.processor:jar:2.3.2 is missing, no dependency information available
[WARNING] The POM for org.eclipse.persistence:org.eclipse.persistence.core:jar:2.2.0-RC4 is missing, no dependency information available
[WARNING] The POM for org.eclipse.persistence:org.eclipse.persistence.jpa:jar:2.2.0-RC4 is missing, no dependency information available
[WARNING] The POM for org.eclipse.persistence:org.eclipse.persistence.jpa.modelgen:jar:2.2.0-RC4 is missing, no dependency information available
[WARNING] The POM for org.eclipse.persistence:org.eclipse.persistence.oracle:jar:2.2.0-RC4 is missing, no dependency information available
[WARNING] The POM for org.eclipse.persistence:org.eclipse.persistence.antlr:jar:2.2.0-RC4 is missing, no dependency information available
[WARNING] The POM for org.eclipse.persistence:org.eclipse.persistence.asm:jar:2.2.0-RC4 is missing, no dependency information available
...
[ERROR] Failed to execute goal on project xxx-ejb: Could not resolve dependencies for project xxx:xxx-ejb:ejb:1.0-SNAPSHOT: The following artifacts could not be resolved: org.eclipse.persistence:eclipselink:jar:2.3.2, org.eclipse.persistence:javax.persistence:jar:2.0.3, org.eclipse.persistence:org.eclipse.persistence.jpa.modelgen.processor:jar:2.3.2, org.eclipse.persistence:org.eclipse.persistence.core:jar:2.2.0-RC4, org.eclipse.persistence:org.eclipse.persistence.jpa:jar:2.2.0-RC4, org.eclipse.persistence:org.eclipse.persistence.jpa.modelgen:jar:2.2.0-RC4, org.eclipse.persistence:org.eclipse.persistence.oracle:jar:2.2.0-RC4, org.eclipse.persistence:org.eclipse.persistence.antlr:jar:2.2.0-RC4, org.eclipse.persistence:org.eclipse.persistence.asm:jar:2.2.0-RC4: Failure to find org.eclipse.persistence:eclipselink:jar:2.3.2 in http://localhost:8993/nexus/content/groups/myrepo/ was cached in the local repository, resolution will not be reattempted until the update interval of MyRepo has elapsed or updates are forced -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :xxx-ejb
Here's the way that I configure the nexus repo (open source version):
I have created a proxy to EclipseLink:
Repository Name: EclipseLink Maven Repository
Type: Proxy
Repository ID: eclipselink
Policy: Snapshot
Remote Storage Location: http://download.eclipse.org/rt/eclipselink/maven.repo/
Download Remote Indexes: False
Repository Path URL: http://localhost:8993/nexus/content/repositories/ecliselink/
As for the repo for the use of maven, I have created a group to lump the necessary repo:
Group Name: My Repository
Group ID: myrepo
In the Ordered Group Repository Lists, I have
:- Apache Snapshots
:- Central
:- Codehaus Snapshots
:- EclipseLink Maven Repository (which is referring to the previously created EclipseLink proxy)
In my pom.xml, the snipped of dependencies are as below:
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.3.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>javax.persistence</artifactId>
<version>2.0.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
<version>2.3.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.appclient</groupId>
<artifactId>gf-client</artifactId>
<version>3.1</version>
<type>pom</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javaee</groupId>
<artifactId>javaee-api</artifactId>
<version>5</version>
<scope>provided</scope>
</dependency>
In the maven settings.xml file, the mirror was defined as:
<mirror>
<id>MyRepo</id>
<name>My Repository</name>
<url>http://localhost:8993/nexus/content/groups/myrepo/</url>
<mirrorOf>*</mirrorOf>
</mirror>
Just to test if one of the jars exists, I have directly call [this is not a link]http://download.eclipse.org/rt/eclipselink/maven.repo/org/eclipse/persistence/eclipselink/2.3.2/eclipselink-2.3.2.jar in the browser and the jar is there. But when I try to get the jar from nexus at [this is not a link]http://localhost:8993/nexus/content/repositories/eclipselink/org/eclipse/persistence/eclipselink/2.3.2/eclipselink-2.3.2.jar, its 404?!
I have updated and repaired the index but all these are to no avail. Any help is truly appreciated.
Thank you.
I find a maven repository URL which works with "Nexus" too:
http://maven.eclipse.org/nexus/content/repositories/Sonatype/
The root of EclipseLink repository gives a 404 error (not when you link a specific jar). This strange behaviour may be is the source of the problem and Nexus cannot index the repository.
Try to use a mirror like this:
http://linorg.usp.br/eclipse/rt/eclipselink/maven.repo/
And also check this related question
Where did the EclipseLink/Maven repository go to? (again)

Categories