Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Maven is looking for .pom file when .jar is present in the repository?

Tags:

maven

pom.xml

I have the following dependency in my pom.xml

<dependency>
    <groupId>aGroup</groupId>
    <artifactId>anArtifact</artifactId>
    <version>aVersion</version>
</dependency>

I also have the anArtifact-aVersion.jar file in ~/.m2/repository/aGroup/anArtifact/aVersion directory.

When I start building the project, maven looks for a .pom file instead of using the .jar file and attempts to download the following

http://repo1.maven.org/maven2/aGroup/anArtifact/aVersion/anArtifact-aVersion.pom

How can I configure maven to use the existing .jar file?

like image 746
Raihan Avatar asked Oct 17 '11 14:10

Raihan


People also ask

Why Maven is not picking jar from local repository?

Try running maven offline mvn clean install -o . This will pick jars from your local repository i.e in . m2. As you mentioned jar is already in local repo, and if all other dependencies are also in local, this will work.

What is .POM file?

A Project Object Model or POM is the fundamental unit of work in Maven. It is an XML file that contains information about the project and configuration details used by Maven to build the project.

Does jar file contains POM xml?

The pom. xml inside JAR is designed for following purposes, Automatic dependency resolution. Deployment of JAR.


2 Answers

POM that is installed to nexus will describe the jar. Used to pull the dependencies that are associated to corresponding jar. When we add the jar as dependency to our project, all the jars required for the included jar will be identified through the corresponding pom.

like image 148
sreddy Avatar answered Sep 22 '22 03:09

sreddy


Run your build using the "-o" switch to use Maven in offline mode. In offline mode, Maven will not check for updates of snapshot dependencies in remote repositories.

like image 35
Daniel Avatar answered Sep 20 '22 03:09

Daniel