I have a small problem with my Maven config. All other questions and answers here didn't solve my problem, so I'm starting a new question.
My problem is, that my Maven is not using the local repository. It's always fetching the artifacts from the remote repositories.
When an artifact is downloaded or when I build a project it is installed in the local repository, so the path is correct.
The problem is: When I build one SNAPSHOT project, it is only installed in the local repository (should be like this, don't want to publish it on my nexus every time). When I build another project having the previous one as dependency in the pom.xml maven wants to download the artifact from the nexus server where it didn't find it instead of taking it from the local repository.
This is my maven config:
<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>C:\Users\Marc\.m2\repository</localRepository>
<interactiveMode>false</interactiveMode>
<usePluginRegistry>false</usePluginRegistry>
<pluginGroups>
</pluginGroups>
<servers>
<server>
<id>releases</id>
<username>MY_USERNAME</username>
<password>MY_PASSWORD</password>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
</server>
<server>
<id>snapshots</id>
<username>MY_USERNAME</username>
<password>MY_PASSWORD</password>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
</server>
<server>
<id>nexus</id>
<username>MY_USERNAME</username>
<password>MY_PASSWORD</password>
<filePermissions>664</filePermissions>
<directoryPermissions>775</directoryPermissions>
</server>
</servers>
<profiles>
<profile>
<id>nexussrv</id>
<repositories>
<repository>
<id>snapshots</id>
<url>http://nexus/content/repositories/snapshots</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
<releases>
<enabled>false</enabled>
</releases>
</repository>
<repository>
<id>releases</id>
<url>http://nexus/content/repositories/releases</url>
<releases>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>nexus</id>
<url>http://nexus/content/groups/public</url>
</repository>
</repositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>nexussrv</activeProfile>
</activeProfiles>
</settings>
Downloading from the nexus and publishing artifacts (SNAPSHOT and RELEASE) to the nexus work with this config but it doesn't use artifacts from the local repository.
Thanks for your Help!
You've configured that the SNAPSHOTs should always (<updatePolicy>always</updatePolicy>
) be downloaded from your snapshot-nexus. So even if your local cache (the ~/.m2/repository
) has a newer version of the snapshot, maven tries to download it from the configured server (http://nexus/content/repositories/snapshots
).
Think about changing the updatePolicy for the snapshot-entry. E.g. if you have a CI-server which deploys a SNAPSHOT daily (in the morning) to the snapshot-nexus, change the updatePolicy to daily
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With