How to fix The POM for XXX:jar:1.0 is missing, no dependency information available - spring-boot

We tried to build our project(Spring Boot 2.0.3 with Maven 3.3.9 dependency management)Jenkins Tool(Linux environment).Its saying build failure showing the following message in console "The POM for org.actus:ACTUS-Core-1.0:jar:1.0 is missing, no dependency information available".ACTUS is our custom java library developed by us and its in the local repository also.
This is the first time we started using Jenkins Tool. There are some other modules which depends on this same ACTUS jar.Those are also failing.I have searched for solution on internet.Some people said,make changes to settings.xml file.But in our development machine ,we cant find any such type of settings.xml file(in .m2)
remaining all dependencies are normal spring boot dependencies only.This is the only one external or custom jar.Using mvn install, we kept in maven local repo.
<dependency>
<groupId>org.actus</groupId>
<artifactId>ACTUS-Core-1.0</artifactId>
<version>1.0</version>
</dependency>

I will try to explain as much I can to solve your problem. I hope you are looking for settings.xml to update your maven Nexus repository. If you don't know about nexus repository, it's kind of public repo where you will get all open source dependency.
In your case, from your organization, you should have a private nexus repository and upload ACTUS-Core jar to there.
Then update your settings.xml file to use your company nexus repository. (Please check comments, it will be available in M2_HOME location)
So while you execute mvn install automatically it will upload in your private repository.
Now, in your pom.xml mention the same nexus repository. (It's optional)
Then, in your Jenkins script, you have updated this nexus repo.
So, the key point is you should have your own repo to upload ACTUS-Core jar and need to access the same while you building in Jenkin tool.
OR ELSE
If you find all the above activities in pain / not possible then I can suggest a short cut solution.
Create a lib folder under your project name ( same hierarchy as src) then add your ACTUS-Core.jar and commit that file along with your source code.
Then, update your pom file like below. It will work.
<dependency>
<groupId>com.test</groupId>
<artifactId>test</artifactId>
<version>11.1</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/fileName.jar</systemPath>
</dependency>

Related

Cannot resolve the SNAPSHOT dependency deployed via Maven deploy-file

I have a problem with Nexus dependency resolution. Nexus version is 3.13.
I have a project "A" which is used as a library across different projects.
I am trying to create
- SNAPSHOT versions to be used for DEV environment
- RELEASE versions will be used after code freeze and to deploy other environments.
I deploy the project "A" as a snapshot to a maven hosted repository(jar file, snapshot repository). I tried "deploy plugin" 3.0.0-M1 and 2.8.2 with uniqueVersion=false. But every time a timestamp is added to the artefacts in Nexus(jar and POM files). I have no issue with timestamp but I cannot resolve the project from other projects.
When I use "LATEST" as the version then the following is the response
"The POM for filename:jar:X.Y.Z-SNAPSHOT is missing, no dependency information available". The POM and JAR is in the repository, but the POM file contains the timestamp suffix as well.
I don't have any problems with release repository for the same project.
Any idea?
Edit :
I used uniqueVersion only for version 2.8.2, for the others there is already an error(or warning).
To deploy project "A", I use the following maven command
mvn deploy:deploy-file -Dfile=target/my-library-0.0.X-SNAPSHOT.jar -DpomFile=pom.xml -DrepositoryId=nexus -Durl=http://my-ip-address/repository/my-library-snapshots.
The POM contained almost nothing actually the usual IDs and a dependency to Lombok.
From the project B, I use only the following
<dependency>
<groupId>Some Group IDs</groupId>
<artifactId>my-library</artifactId>
<version>LATEST</version>
</dependency>
Instead of LATEST, I also tried expilicitly giving version number in nexus.
I found the issue. It was related to my settings.xml file. I added another element under "profile" element called "id"
<profiles>
<profile>
<id>nexus</id>

How can I add maven artifact into an existing maven project

How can I add maven artifact into an existing maven project.I understand that I can build a jar locally and use file: protocol but this is possible using maven also.
For example I have a basic maven project
https://maven.apache.org/guides/getting-started/index.html#How_do_I_make_my_first_Maven_project and the artifact:
<repositories>
<repository>
<id>myrepo.org</id>
<name>MyRepository</name>
<url>http://mywork.com/repository</url>
</repository>
</repositories>
<dependency>
<groupId>org.ethereum</groupId>
<artifactId>ethereumj-core</artifactId>
<version>1.1.0-RELEASE</version>
I tried adding the code above to the project pom.xml fails because dependency is not in central maven repo.
mvn clean install
I then tried editing my settings.xml by adding the tag, that also failed because dependency was not found.
Im overlooking something pretty basic here.
Maven works on the concept of local and remote repositories.
The local repository refers to a copy on your own installation that is a cache of the remote downloads, and also contains the temporary build artifacts that you have not yet released.
Remote repository is repository you access the artifacts via file or http / ftp protocols , it can be an internal repo or a remote public hosted.
When you add dependency maven search that artifact in local if not found then remote repo will be searched. Still not found then error is reported.
https://maven.apache.org/guides/introduction/introduction-to-repositories.html
In your case, 'ethereumj-core' can not be located neither of location, you need find this jar and do a manual install to local repo.
mvn install:install-file -Dfile=< folder >\ethereumj-core.1.1.0-RELEASE.jar -DgroupId=org.ethereum
-DartifactId=ethereumj-core -Dversion=1.1.0-RELEASE -Dpackaging=jar
once properly installed maven should be able find this artifact when you add this as dependency to any of the projects (in pom.xml).
<dependency>
<groupId>org.ethereum</groupId>
<artifactId>ethereumj-core</artifactId>
<version>1.1.0-RELEASE</version>
</dependency>

How to manage maven depend project from Artifactory?

Inside a Parent project i have multiple project and take this simple example Project common-3rdparty used as a depend project for Project B and in Project B pom.xml file i have added below lines
<dependencies>
<dependency>
<groupId>com.pre.cdd.common</groupId>
<artifactId>common-3rdparty</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>jar</type>
</dependency>
</dependencies>
Now i am using Artifactory for dependency management and added common-3rdparty project into Artifactory but now when i am running mvn eclipse:eclipse project build successful but common-3rdparty.jar not downloaded so Project B giving exception
common-3rdparty.jar missing
So it mean somehow common-3rdparty.jar not downloaded from Artifactory . What i am doing wrong here?
EDIT:-
Now my simple question is that if i have 10 project and 9 project needed to run 10th one so we added 9 dependencies in 10th project pom.xml now what changes i have to do in Artifactory side or pom file so it will easily get depended projects.
The remote-repos contain only the remote repositories (hence the name). If you deployed the jar into Artifactory yourself, it resides in one of the local repositories, that's why maven can't find it. You should use lib-releses instead of remote-repos in your maven configuration.

Including QRGen in pom.xml

I'm developing app in spring + hibernate in maven and I need to make QR codes so
I've found this tutorial http://viralpatel.net/blogs/create-qr-codes-java-servlet-qr-code-java/
In that tutorial following libs are in use:
xzing and qrgen (net.glxn.qrgen)
I've added in pom.xml dependency on xzing and its running but qrgen needs his own repo so
I've included repository like on that page: http://kenglxn.github.com/QRGen/ :
but it seems that http://kenglxn.github.com/QRGen/repository is down
Anyone knows new (or exact) repo address or could tell me what I'm doing wrong
version 1.2 is now available from maven central http://search.maven.org/#artifactdetails%7Cnet.glxn%7Cqrgen%7C1.2%7Cjar
please use:
<dependency>
<groupId>net.glxn</groupId>
<artifactId>qrgen</artifactId>
<version>1.2</version>
</dependency>
Basically you have a third party JAR that is not available in a (public) repository. Best would be if you had a company wide repository that you use as proxy. It is quite easy to set up Nexus for this task. Then you can import the JAR to that repository (e.g. Nexus has a default "3rd party library" repository setting). If you don't have such a repository you need to import the JAR to your local repository but this restricts successfull builds to your machine - obviously not what you want when you use Maven. See here for the syntax for a local import.
Of course you could set up a network drive as a company wide repo, some think this is easier than setting up Nexus or any other repo server. Trust me, it is not worth it, do it the right way from the beginning.

about generate maven dependency

I am pretty new to maven.
Now I have a maven project developed. My another project needs to depend on this one.
Does anyone know how can I generate my own dependency? So that my second project can add the first one as a dependency in pom.
thank you very much
Since your first project is already a maven-project, just install it in your local repository by running mvn install in the first project's root directory.
Then you can include a dependency in your second project by simply referencing the groupId, artifactId and version you defined in the first project.
So if your first project had the following in its pom:
<project>
<groupId>com.yourdomain</groupId>
<artifactId>yourcomponent</artifactId>
<version>1.0</version>
... <!-- more here -->
you can include this in your second project:
<dependencies>
<dependency>
<groupId>com.yourdomain</groupId>
<artifactId>yourcomponent</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
Unless you deploy your project 1 jar to a central maven repository, this will only work if your jar is in your local repository (via mvn install).
Maven projects are identified by the "Maven coordinates", that is, the ArtifactID, GroupID and version.
Say you create your first project and run maven install. Your local repository (in $HOME/.m2/) will now contain the compiled project plus whatever coordinates you put in there.
Your second project must now only depend on the said coordinates.
I would suggest googling a bit on maven. I made a tutorial a long time ago that might help you, even if the examples are a little simple. Here you go and good luck!

Resources