I'm reconfiguring a build server that someone else setup a long time ago to use a new Maven repository. However, the old repository is still being referenced and I can't figure out where that reference is coming from.
M2_HOME=/usr/share/maven2
/etc/maven2/m2.conf (usr/share/maven2/conf/m2.conf links here)
main is org.apache.maven.cli.MavenCli from plexus.core
set maven.home default ${user.home}/m2
[plexus.core]
load ${maven.home}/lib/*.jar
/etc/maven2/conf also has a settings.xml with all entries commented out.
The build user has a ~/.m2/settings.xml: referencing NewRepo.
<settings>
<pluginGroups>
</pluginGroups>
<servers>
</servers>
<profiles>
<profile>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<id>personal</id>
<repositories>
<repository>
<id>new-repo</id>
<name>New Maven 2 Repo</name>
<url>http://NewRepo/</url>
</repository>
<!-- Some other standard repos like maven.org here -->
</repositories>
<pluginRepositories>
<pluginRepository>
<id>ibiblio</id>
<name>Ibiblio Maven 2 Repo</name>
<url>http://repo1.maven.org/maven2/</url>
</pluginRepository>
<pluginRepository>
<id>apache-snapshots</id>
<name>Apache Snapshots Maven 2 Repo</name>
<url>http://people.apache.org./maven-snapshot-repository/</url>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
</settings>
There is also a /mnt/public/maven/settings.xml with the exact same content as the build user's settings.xml
I searched the entire file system to ensure there are no other settings.xml files.
When running
mvn release:prepare
I get the warning:
[INFO] NOTE: Maven is executing in
offline mode. Any artifacts not
already in your local repository will
be inaccessible.
When running
mvn release:perform
I get the error:
Error deploying artifact: Failed to
transfer file: http://OldRepo
Where could that reference to http://OldRepo be hiding?
EDIT
The project's pom.xml references a parent POM as follows:
<parent>
<groupId>MyParent</groupId>
<artifactId>maven</artifactId>
<version>20090727</version>
</parent>
There is no reference to
<distributionManagement>
in the project's POM. I have been unable to locate the parent POM.
Best Answer
About
repositories
inside aprofile
declared in thesettings.xml
, the documentation says:So this is not used for release management. To configure where an artifact is deployed, you need to add a
distributionManagement
element in your pom.The following is an example of how a
distributionManagement
element can be configured within a project pom.xml file.Look for this element in your pom or in a parent pom (it could be declared in a corporate parent pom).
EDIT: you can override the
distributionManagement
in your pom but it would be better to modify it in the parent pom and release this new version in your enterprise repository if this is a definitive change.