mhrsalehi
mhrsalehi

Reputation: 1384

how to exclude maven central repository from mirror and access it directly?

we have a Nexus server for our Maven repository, but for some reasons that I do not know the nexus can not reach maven central, its status is : "In Service Attempting to Proxy and Remote Unavailable". this is my settings.xml in .m2 directory:

<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/>
  <interactiveMode/>
  <usePluginRegistry/>
  <offline/>
  <pluginGroups/>
  <servers>
  <server>
      <id>nexus</id>
      <username>uuuu</username>
      <password>ppppp</password>
    </server>
    <server>
      <id>releases</id>
      <username>uu</username>
      <password>ppp</password>
      <filePermissions>664</filePermissions>
      <directoryPermissions>775</directoryPermissions>
    </server>
    <server>
      <id>snapshots</id>
      <username>user1</username>
      <password>pass1</password>
      <filePermissions>664</filePermissions>
      <directoryPermissions>775</directoryPermissions>
    </server>
  </servers>
  <mirrors>
    <mirror>
        <!--This sends everything else to /public -->
        <id>nexus</id>
    <mirrorOf>*</mirrorOf>
        <url>http://192.168.0.120/nexus/content/groups/public</url>
    </mirror>
  </mirrors>
  <proxies/>
  <profiles>
  <profile>
    <id>nexus</id>
    <repositories>
      <repository>
        <id>central</id>
        <url>http://central</url>
        <releases><enabled>true</enabled></releases>
        <snapshots><enabled>true</enabled></snapshots>
      </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>
  <activeProfiles>
    <activeProfile>nexus</activeProfile>
  </activeProfiles>
</settings>

how can i configure maven to use central repo directly without going through nexus?

Upvotes: 0

Views: 3718

Answers (1)

J Fabian Meier
J Fabian Meier

Reputation: 35785

Probably the best idea would be to repair the Nexus.

But if this is not an option, you could replace the <mirrorOf>*</mirrorOf> by <mirrorOf>*,!central</mirrorOf> and replace the http:/central in the repositories definition by the correct https url of MavenCentral.

Upvotes: 2

Related Questions