I switched to a SNAPSHOT version of a plugin I use, and declared the corresponding snapshot repository in the POM like this:
<project>
<!-- ... -->
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-maven-plugin</artifactId>
<version>2.3.0-SNAPSHOT</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<repositories>
<repository>
<id>apache.snapshots</id>
<name>Apache Snapshot Repository</name>
<url>http://repository.apache.org/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
</project>
Now Maven keeps complaining about not being able to download the plugin from our corporate repository (which does not mirror anything on the internet) - it just ignores the repository defined in the POM.
By default, Maven will always look in the official Maven repository, which is http://repo1.maven.org. When Maven tries to build a project, it will look in your local repository (by default ~/. m2/repository but you can configure it by changing the <localRepository> value in your ~/. m2/settings.
Putting non-standard repositories in the pom. xml file (which gets checked into source control) means every developer can build. But YES, your authentication for a repository server should be in your private settings. xml file.
Google's Maven repository can be accessed from https://maven.google.com (an alternative URL is https://dl.google.com/dl/android/maven2/). If you are using Gradle 4.1 or higher, you can use it by adding google() to your repositories configuration in your build.
I forgot (again) that Maven distinguishes between repositories
and pluginRepositories
. The following code works fine:
<project>
<!-- ... -->
<pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<name>Apache Snapshot Repository</name>
<url>http://repository.apache.org/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</project>
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