Skip to content

Instantly share code, notes, and snippets.

@pnminh
Last active November 19, 2019 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pnminh/2e15c7c444561320fb14e1ca398f07ca to your computer and use it in GitHub Desktop.
Save pnminh/2e15c7c444561320fb14e1ca398f07ca to your computer and use it in GitHub Desktop.
a sample maven settings.xml that provides mirror to maven central and deployment repos for releases and snapshots
<?xml version="1.0" encoding="UTF-8"?>
<settings>
<mirrors>
<mirror>
<!--Send all requests to the mirror repo except the 2 org ones for snapshots and release-->
<!-- This helps with resolving urls using environment variables if the value gets changed -->
<id>maven-public</id>
<mirrorOf>*,!org-snapshots,!org-releases,!confluent-releases</mirrorOf>
<url>https://org.jfrog.io/org/maven-public</url>
</mirror>
</mirrors>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>org-maven</activeProfile>
</activeProfiles>
<profiles>
<profile>
<id>default-repo-url</id>
<activation>
<property>
<name>!env.REPO_URL</name>
</property>
</activation>
<properties>
<env.REPO_URL>https://org.jfrog.io/org</env.REPO_URL>
</properties>
</profile>
<profile>
<id>org-maven</id>
<properties>
<!--this is for deployment only, supported by deploy plugin >= v2.8
https://maven.apache.org/plugins/maven-deploy-plugin/deploy-mojo.html
-->
<altSnapshotDeploymentRepository>org-snapshots::default::${env.REPO_URL}/maven-snapshots</altSnapshotDeploymentRepository>
<altReleaseDeploymentRepository>org-releases::default::${env.REPO_URL}/maven-releases</altReleaseDeploymentRepository>
</properties>
<repositories>
<!--Override the repository (and pluginRepository) "central" from the Maven Super POM
to activate snapshots for both! -->
<repository>
<id>central</id>
<url>http://central</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>org-releases</id>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>${env.REPO_URL}/maven-releases</url>
</repository>
<repository>
<id>org-snapshots</id>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
<url>${env.REPO_URL}/maven-snapshots</url>
</repository>
<repository>
<id>confluent-releases</id>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>http://packages.confluent.io/maven/</url>
</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>
<servers>
<server>
<id>maven-public</id>
<username>user</username>
<password>pass</password>
</server>
<server>
<id>org-snapshots</id>
<username>user</username>
<password>pass</password>
</server>
<server>
<id>org-releases</id>
<username>user</username>
<password>pass</password>
</server>
</servers>
</settings>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment