Trooble with settings.xml during transition Nexus 2 to Nexus 3

931 views
Skip to first unread message

Nicolas Rosado

unread,
Apr 26, 2016, 10:32:48 AM4/26/16
to Nexus Users
Hi everybody,

I have some trooble with the configuration of settings.xml.
Indeed, in my company I have already installed the nexus 3 OSS and I have already uploaded some libraries. 

When I use this configuration I can download perfectly librairies available through my nexus 3 :

<settings>
 <mirrors>
   <mirror>
     <id>nexus</id>
     <mirrorOf>*</mirrorOf>
     <url>http://myhost:myport/nexus/repository/maven-public/</url>
   </mirror>
 </mirrors>
 <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>
 <servers>
    <server>
      <id>nexus</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
 </servers>
</settings>

But in my CI server, I need to use the nexus 3 and the nexus 2.
So I need to configure my settings.xml with the two nexus.

For the time being I didn't find the good configuration of my settings.xml.

Could you help me ?

I tried this configuration : 

<settings>
 <mirrors>
   <mirror>
     <id>nexus3</id>
     <mirrorOf>*</mirrorOf>
     <url>http://myhost:myport/nexus/repository/maven-public/</url>
   </mirror>
  <mirror>
     <id>nexus2</id>
     <mirrorOf>*</mirrorOf>
     <url>http://myhost:myport/nexus/repository/maven-public/</url>
   </mirror>
 </mirrors>
 <profiles>
  <profile>
     <id>nexus2</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>
   <profile>
     <id>nexus3</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>nexus2</activeProfile>
   <activeProfile>nexus3</activeProfile>
 </activeProfiles>
 <servers>
    <server>
      <id>nexus3</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
 </servers>
</settings>

Please find below the error met when the maven clean install use the bad repository :

[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project******:version-SNAPSHOT (/home/nrosado/Bureau/livraisons/livraison_****/pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM: Failure to find **** in http://****/nexus/repository/maven-public/ was cached in the local repository, resolution will not be reattempted until the update interval of nexus3 has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 10, column 13 -> [Help 2]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:

Brian Fox

unread,
Apr 26, 2016, 10:56:58 AM4/26/16
to Nicolas Rosado, Nexus Users
I originally wrote the mirrorOf * code in Maven and I don't think it supports multiples properly, or at least it was not an intended use case. You could do mirrorOf (some list) for example to point at Nexus 2 and have the wildcard point at 3.

--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users...@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.
To view this discussion on the web visit https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/21fe8229-a1ff-4c81-a7e2-eefc6c9c42ef%40glists.sonatype.com.
For more options, visit https://groups.google.com/a/glists.sonatype.com/d/optout.

Rich Seddon

unread,
Apr 26, 2016, 11:02:47 AM4/26/16
to Nexus Users, Nicolas Rosado
Have a look here, there is an example that might work:


But if you're in control of one of these Nexus instances a far better solution would be to create a proxy repository in it that points at the other, and then use a single mirror in your settings.xml.

Rich

Nicolas Rosado

unread,
Apr 26, 2016, 11:39:53 AM4/26/16
to Nexus Users
Thanks for your advise and your link. I try to modify my configuration like below but it doesn't work :

<settings>
 <mirrors>
  <mirror>
     <id>nexus2</id>
     <mirrorOf>external:*,!nexus3</mirrorOf>
     <url>http://myhost:myport/nexus/repository/maven-public/</url>
   </mirror>
   <mirror>
     <id>nexus3</id>
     <mirrorOf>nexus3</mirrorOf>
     <url>http://myhost:myport/nexus/repository/maven-public/</url>
   </mirror>
 </mirrors>
 <profiles>
  <profile>
     <id>nexus2</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>nexus2</activeProfile>
   <activeProfile>nexus3</activeProfile>
 </activeProfiles>
 <servers>
    <server>
      <id>nexus3</id>
      <username>admin</username>
      <password>admin123</password>
    </server>
 </servers>
</settings> 
 
In your latest comment, you told me that I can use a proxy. Do you have a sample ? 

Thanks in advance for your time and your response.

Manfred Moser

unread,
Apr 26, 2016, 11:44:08 AM4/26/16
to Nicolas Rosado, Nexus Users
I agree with the suggestion from Rich .. it is by far the most simple
and reliable setup. Here is what he means:

In 3.x create a proxy repository that uses mixed policy and points to
the public group in 2.x

Then add that proxy repository to the maven-public group in 3.x

And in terms of the settings file.. just use the one that points to 3.x only.

Any components not found in 3.x directly will be proxied from 2.x into
3.x and then served from there to your CI builds..

Hth

Manfred
> --
> You received this message because you are subscribed to the Google Groups
> "Nexus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nexus-users...@glists.sonatype.com.
> To post to this group, send email to nexus...@glists.sonatype.com.
> To view this discussion on the web visit
> https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/9041a74d-937a-4475-aa57-bb0853da2e48%40glists.sonatype.com.

Nicolas Rosado

unread,
Apr 26, 2016, 11:47:42 AM4/26/16
to Nexus Users
Thanks for your response, I will try the solution with the proxy and I come back to you if I have problems. 
 

Nicolas Rosado

unread,
Apr 27, 2016, 12:22:38 PM4/27/16
to Nexus Users
Hi,

I followed your advise. I created a maven2 proxy repository "nexus2" with the configuration below : 

- type of artifacts : mixed

But in the repositories summary, when I see the satus column, the error below is display :
Online - Remote Auto Blocked and Unavailable
Connect to myhost failed: Connexion refusée

Morever, I tested with a http settings authentication below without success : 
username : admin
password admin123 


Could you tell me if I forgot something ? 

See below my configuration for my settings.xml that contain one mirror for nexus 3 :

<settings>
  <mirrors>
    <mirror>
      <!--This sends everything else to /public -->
      <id>nexus</id>
      <mirrorOf>*</mirrorOf>
     <url>http://myhost:myport/nexus/repository/maven-public/</url>
    </mirror>
  </mirrors>
  <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://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>
    <!--make the profile active all the time -->
Capture du 2016-04-27 18:12:32.png

Nicolas Rosado

unread,
Apr 27, 2016, 12:24:22 PM4/27/16
to Nexus Users
Off course I added the nexus2 repository to my maven-public group in nexus 3.
But the problem is that the connection failed with nexus2.


Manfred Moser

unread,
Apr 27, 2016, 12:28:31 PM4/27/16
to Nicolas Rosado, Nexus Users
It sounds like there is a network issue preventing the 3.x server from
accessing the 2.x server? Can you try a simple ping or so?

Also if you require authentication for 2.x access you have to
configure that as part of the repository in 3.x
> --
> You received this message because you are subscribed to the Google Groups
> "Nexus Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to nexus-users...@glists.sonatype.com.
> To post to this group, send email to nexus...@glists.sonatype.com.
> To view this discussion on the web visit
> https://groups.google.com/a/glists.sonatype.com/d/msgid/nexus-users/d0c0240c-904f-43af-937a-3888128e4767%40glists.sonatype.com.

Rich Seddon

unread,
Apr 27, 2016, 12:40:26 PM4/27/16
to Nicolas Rosado, Nexus Users
The error in the proxy is "connection refused".   So Nexus cannot reach the remote host, something is blocking access.

Do you have an http proxy server configured in the nexus instance?  If so, you may need to add the remote nexus host to the non-proxy hosts list.


--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users...@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.

Nicolas Rosado

unread,
Apr 28, 2016, 11:17:36 AM4/28/16
to Nexus Users
Hi both,

I need your help to find the correct configuration.
I have no proxy in nexus 2 or 3 and when I enter in my web browser the url that I filled in remote storage (location of the remote repository being proxied), I access to my repository perfectly. 
So I don't understand what is the problem. Morever I can ping my host without any problem.

Please find attached 3 screens of http settings in my nexus 2 and 3.

Could you suggest me an other solution or a way to avoid the error below :
"connection refused"

Thanks in advance for your response and your time.
nexus2_proxy_settings.png
nexus_3_proxy_settings.png
proxy_settings_repository_nexus2_in_nexus3.png

Rich Seddon

unread,
Apr 28, 2016, 11:27:31 AM4/28/16
to Nicolas Rosado, Nexus Users
Can you generate a support zip in nexus and attach it to a ticket at https://support.sonatype.com?  We can take a look.

You can generate the support zip in the admin UI under "support tools/support zip".

--
You received this message because you are subscribed to the Google Groups "Nexus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nexus-users...@glists.sonatype.com.
To post to this group, send email to nexus...@glists.sonatype.com.

Nicolas Rosado

unread,
May 2, 2016, 5:33:26 AM5/2/16
to Nexus Users
Thanks you so much for your analyse and your time. 
I see the problem with my network administrator and now it's ok. I can download nexus 2 librairies throught the nexus 3 !

Finally, like you told me your team, the good way was just specify the correct port.It was a general networking error reaching port. 

Reply all
Reply to author
Forward
0 new messages