I'm trying to integrate nexus into a maven project and having a problem, hoping someone here can help out.
Initially I had my maven settings.xml
file to use a local repository only:
<settings>
<localRepository>C:\\r</localRepository>
...
</settings>
This works fine and all dependencies for my project are downloaded into the local repository. I verified this by deleting the directory for the maven-settings-2.2.1
artifact and running mvn -U dependency:list
again:
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/maven-settings/2.2.1/maven-settings-2.2.1.pom Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/maven-settings/2.2.1/maven-settings-2.2.1.pom (3 KB at 11.3 KB/sec) Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/maven-settings/2.2.1/maven-settings-2.2.1.jar Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/maven-settings/2.2.1/maven-settings-2.2.1.jar (48 KB at 509.5 KB/sec)
It is seen above that the pom.xml
and .jar
file for the maven-settings-2.2.1
artifact have been downloaded.
Next I tried configuring my maven project to point to a nexus repository that I have set up:
<settings>
<localRepository>C:\\r</localRepository>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>*</mirrorOf>
<url>http://<server>:<port>/nexus/content/groups/public</url>
</mirror>
</mirrors>
...
</settings>
I deleted the maven-settings-2.2.1
artifacts from my local repository, and ran mvn -U dependency:list
again:
Downloading: http://:/nexus/content/groups/public/org/apache/maven/maven-settings/2.2.1/maven-settings-2.2.1.pom Downloaded: http://:/nexus/content/groups/public/org/apache/maven/maven-settings/2.2.1/maven-settings-2.2.1.pom (3 KB at 17.0 KB/sec) Downloading: http://:/nexus/content/groups/public/org/apache/maven/maven-settings/2.2.1/maven-settings-2.2.1.jar [ERROR] Failed to execute goal on project : Could not resolve dependencies for project : The following artifacts could not be resolved: org.apache.maven:maven-settings:jar:2.2.1: Could not find artifact org.apache.maven:maven-settings:jar:2.2.1 in nexus (http://:/nexus/content/groups/public) -> [Help 1]
This time, nexus can download the pom.xml
file the maven-settings-2.2.1
artifact, but cannot download the .jar
file. I checked on the nexus server and when I browse the remote contents of the 'central' repository I can see the maven-settings-2.2.1
artifacts (both pom.xml
and .jar
file), but in the nexus local storage I see the pom.xml
file only.
So I looked at the nexus documentation (see http://books.sonatype.com/nexus-book/reference/maven-sect-single-group.html) and set up my maven settings with a nexus profile as suggested:
<settings>
... as before ...
<profiles>
<profile>
<id>nexus</id>
<repositories>
<repository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://central</url>
<releases><enabled>true</enabled></releases>
<snapshots><enabled>true</enabled></snapshots>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
Again I deleted any local copy of maven-settings-2.2.1
artifact, and ran mvn -U dependency:list
:
Downloading: http://:/nexus/content/groups/public/org/apache/maven/maven-settings/2.2.1/maven-settings-2.2.1.pom Downloaded: http://:/nexus/content/groups/public/org/apache/maven/maven-settings/2.2.1/maven-settings-2.2.1.pom Downloading: http://:/nexus/content/groups/public/org/apache/maven/maven-settings/2.2.1/maven-settings-2.2.1.jar [ERROR] Failed to execute goal on project : Could not resolve dependencies for project : The following artifacts could not be resolved: org.apache.maven:maven-settings:jar:2.2.1: Could not find artifact org.apache.maven:maven-settings:jar:2.2.1 in nexus (http://:/nexus/content/groups/public) -> [Help 1]
As before, the pom.xml
was downloaded from nexus, but not the .jar
file. And as before, when I inspect the local storage on the nexus server, the pom.xml
file is present, but not the .jar
file.
As a sanity test, I removed the nexus configuration from my maven settings.xml
, removed the maven-settings-2.2.1
artifacts from my local repository, and tried again:
Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/maven-settings/2.2.1/maven-settings-2.2.1.pom Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/maven-settings/2.2.1/maven-settings-2.2.1.pom Downloading: http://repo.maven.apache.org/maven2/org/apache/maven/maven-settings/2.2.1/maven-settings-2.2.1.jar Downloaded: http://repo.maven.apache.org/maven2/org/apache/maven/maven-settings/2.2.1/maven-settings-2.2.1.jar
This time, both the pom.xml
and `.jar file were downloaded directly.
So I am not sure what I need to do to get around this issue: when using a local repository and get maven to download dependencies directly, I can download both the pom.xml
and .jar
files for the maven-settings-2.2.1
artifact. When I add my nexus server into the mix, only the pom.xml
is downloaded by nexus.
Is this a nexus server configuration issue, or a maven configuration issue?