How to configure maven to access the maven center if the nexus server is down?

I would like to set up my assembly so that it automatically tries to download the artifact from the maven center if our nexus server is unavailable. I have the following in settings.xml and I'm not sure how to change it (if possible).

<profiles> <profile> <id>nexus</id> <!--Enable snapshots for the built in central repo to direct --> <!--all requests to nexus via the mirror --> <repositories> <repository> <id>central</id> <url>http://mynexus</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>central</id> <url>http://mynexus</url> <releases><enabled>true</enabled></releases> <snapshots><enabled>true</enabled></snapshots> </pluginRepository> </pluginRepositories> </profile> </profiles> <activeProfiles> <activeProfile>nexus</activeProfile> </activeProfiles> 
+5
source share
1 answer

To use the repository manager (including Nexus), you need to define a mirrorOf * element that will intercept all the repository URLs and send them to Nexus for permission. In Maven2 and 3, the mirrorOf element cannot be configured in the profile. This means that there is no easy way to flip back and forth without changing the settings.

You will need to comment on the mirrors section, and then disable the Nexus profile so that Maven returns to the standard behavior.

Fortunately, although the Nexus is very stable, it should never go down.

+2
source

Source: https://habr.com/ru/post/919002/


All Articles