Reputation: 782
I am newbie to Maven, My question described below:
I have a jar file in the following repo: http://www.repo.com/custom/path/Jarfile-0.1.0.jar
I have added the repository to the pom file as follows
<repository>
<url>http://www.repo.com/custom/path </url>
<id>Custom_repo</id>
</repository>
I have set the dependency in the pom file as follows:
<dependancy>
<groupId>XXX<groupId>
<artifactId>Jarfile</artifactId>
<version>0.1.0</version>
</depandancy>
when I do a compile 'mvn compile' The output is:
Downloading: http:/www.repo.com/custom/path/XXX/Jarfile/0.1.0/Jarfile-0.1.0.pom
[ERROR] Failed to execute goal on project X: could not resolve dependencies for project ... could not transfer artifact from Custom_repo...
There are two issues:
Thank You.
Upvotes: 4
Views: 972
Reputation: 7717
The maven repo is a little bit more complex than a simple jar. You can try to install a reposotory server such as Nexus.
http://www.sonatype.org/nexus/
See also this post Maven Internal Repository, Is it Really This Hard?
You can also install the jar file on local repository through:
mvn install:install-file -Dfile=<path-to-file> -DpomFile=<path-to-pomfile>
Maven Dependency Search Sequence
Step 1 - Search dependency in local repository, if not found, move to step 2 else if found then do the further processing.
Step 2 - Search dependency in central repository, if not found and remote repository/repositories is/are mentioned then move to step 4 else if found, then it is downloaded to local repository for future reference.
Step 3 - If a remote repository has not been mentioned, Maven simply stops the processing and throws error (Unable to find dependency).
Step 4 - Search dependency in remote repository or repositories, if found then it is downloaded to local repository for future reference otherwise Maven as expected stop processing and throws error (Unable to find dependency).
Upvotes: 2