0

I am trying to build my project including these two dependencies :

 <dependency>
            <groupId>org.cytoscape</groupId>
            <artifactId>vizmap-api</artifactId>
            <version>3.6.0</version>
        </dependency>
        <dependency>
            <groupId>org.cytoscape</groupId>
            <artifactId>viewmodel-api</artifactId>
            <version>3.6.0</version>
        </dependency>

I also have included in my POM this repository tag:

 <repositories>
    <repository>
        <id>cytoscape_snapshots</id>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <releases>
            <enabled>false</enabled>
        </releases>
        <name>Cytoscape Snapshots</name>
        <url>http://code.cytoscape.org/nexus/content/repositories/snapshots/</url>
    </repository>
    <repository>
        <id>cytoscape_releases</id>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
        <name>Cytoscape Releases</name>
        <url>http://code.cytoscape.org/nexus/content/repositories/releases/</url>
    </repository>
</repositories>

Then I got this error during the build :

[ERROR] Failed to execute goal on project CyPlugin: Could not resolve dependencies for project GraphSYSBIO:CyPlugin:bundle:1.0-SNAPSHOT: The following artifacts could not be resolved: org.cytoscape:vizmap-api:jar:3.6.0, org.cytoscape:viewmodel-api:jar:3.6.0: Could not find artifact org.cytoscape:vizmap-api:jar:3.6.0 in nexus (http://our_nexus_server:8081/nexus/content/groups/public/) -> [Help 1]

In my settings.xml I'm using a proxy :

<proxies>
    <!-- proxy | Specification for one proxy, to be used in connecting to the 
        network. | -->
     <proxy>
        <id>optional</id>
        <active>true</active>
        <protocol>http</protocol>
        <username>proxyuser</username>
        <password>proxypass</password>
        <host>ourHost</host>
        <port>8080</port>
        <nonProxyHosts>*localAddress</nonProxyHosts>
    </proxy>
</proxies>

Also using mirrors:

<mirrors>
    <!-- mirror | Specifies a repository mirror site to use instead of a given 
        repository. The repository that | this mirror serves has an ID that matches 
        the mirrorOf element of this mirror. IDs are used | for inheritance and direct 
        lookup purposes, and must be unique across the set of mirrors. | -->
    <mirror>
          <id>nexus</id>
          <mirrorOf>*</mirrorOf>
          <name>Our Local Nexus Repo</name>
                  <url>our_nexus:8081/nexus/content/groups/public/</url>   
</mirror>
</mirrors>

My question is : How to tell maven to go find these two dependencies in the cytoscape.org/nexus/ nexus and not on our nexus server.

Is mirroring could be a solution for this problem?

The link of the cytoscape.org/nexus/ is : http://code.cytoscape.org/nexus/content/repositories/releases/org/cytoscape/vizmap-api/3.6.0/

ErEcTuS
  • 777
  • 1
  • 14
  • 33

2 Answers2

1

Add an exception to your mirror configuration:

<mirrorOf>*,!cytoscape_releases,!cytoscape_snapshots</mirrorOf>

For those repositories it will then try to download them directly instead of going through the mirror.

However, the clean solution would just be to add those repositories to your Nexus as proxied repositories. Otherwise, everybody who wants to build your project, has to adapt his local mirror configuration.

dunni
  • 43,386
  • 10
  • 104
  • 99
  • Hello dunni, thanks for replying. I've tried that, as well as Essex Boy solution proposition and I got Access denied to: http://code.cytoscape.org/nexus/content/repositories/releases/org/cytoscape/vizmap-api/3.6.0/vizmap-api-3.6.0.pom , ReasonPhrase:Forbidden. -> [Help 1] [ERROR] / I'm not sure how to add those 2 repositories as proxied repositories. Is there any example in the documentation – ErEcTuS Feb 12 '18 at 15:23
  • ? From the message, it looks like something is blocking access. Are you behind a corporate firewall – rseddon Feb 13 '18 at 14:46
1

As has been said you can simply add mutiple repositories to your settings.xml

 <repositories>
   <repository>
     <id>my-repo2</id>
     <name>your custom repo</name>
     <url>http://jarsm2.dyndns.dk</url>
   </repository>
   <repository>
     <id>my-repo3</id>
     <name>your custom repo</name>
     <url>http://jarsm3.dyndns.dk</url>
   </repository>
 </repositories>

It will go through the repositories in order to resolve a dependency.

doc is here

If the server hosting the repositoryr equires credentials this see here

Essex Boy
  • 7,565
  • 2
  • 21
  • 24
  • Hey Essex Boy, thanl for replying. I got the same error as before, but when I added "*,!cytoscape_releases,!cytoscape_snapshots" as dunni proposed I got Access Denied. Not sure what do do next – ErEcTuS Feb 12 '18 at 15:25
  • I had one server tag already but without the ssh part...still no luck – ErEcTuS Feb 12 '18 at 16:15