Missing maven dependency using nexus setup

2019-05-11 03:44发布

问题:

I am trying to build a maven project to test out some testing software - Arquillian.

I setup nexus and added the jboss repositories to the bottom of the public group.

When i run mvn test i get this error:

Missing:
----------
1) com.sun.istack:istack-commons-runtime:jar:1.1-SNAPSHOT

  Try downloading the file manually from the project website.

  Then, install it using the command:
      mvn install:install-file -DgroupId=com.sun.istack -DartifactId=istack-commons-runtime -Dversion=1.1-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file

  Alternatively, if you host your own repository you can deploy the file there:
      mvn deploy:deploy-file -DgroupId=com.sun.istack -DartifactId=istack-commons-runtime -Dversion=1.1-SNAPSHOT -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

  Path to dependency:
        1) org.jboss.arquillian.sandbox.showcase:arquillian-sandbox-showcase-jsf:jar:1.0.0-SNAPSHOT
        2) org.jboss.jbossas:jboss-as-client:pom:6.0.0.20100721-M4
        3) org.jboss.jbossas:jboss-as-iiop:jar:client:6.0.0.20100721-M4
        4) org.jboss.jbossts:jbossjts:jar:4.11.0.Final
        5) org.jboss.ws.native:jbossws-native-core:jar:3.3.0.CR1.SP2
        6) com.sun.xml.ws:jaxws-rt:jar:2.2
        7) com.sun.xml.ws:policy:jar:2.0-b01
        8) com.sun.istack:istack-commons-runtime:jar:1.1-SNAPSHOT

I checked the java.net maven 2 repository and it is definately there.

However when i navigate to my local nexus public group, it is not there.

How can i solve this problem? And what is the cause of this problem? I am in way over my head with this, as I am more accustomed to using ant+ivy.

The full output from mvn is here.

回答1:

I had apparently the exact same problem. I solved it. In my case, the problem was that the repository that was hosting istack-common-runtime-1.1.0-SNAPSHOT was flagged "release" in the configured nexus proxy repo. So nexus was ignoring all snapshots in that repository. I just configured another proxy repository pointing on the same one that contains istack-common-runtime-1.1.0-SNAPSHOT, but flagging it to "SNAPSHOT" when configuring it. I then added this new proxy to my "SNAPSHOT" group.

In my settings.xml, I have a repository on the public nexus group and another on the snapshots group :

<profiles>
    <profile>
        <id>nexus</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <repositories>
            <repository>
                <id>release</id>
                <url>http://nexus-server/nexus/content/groups/public</url>
                <releases>
                    <enabled>true</enabled>
                </releases>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
            </repository>
            <repository>
                <id>snapshots</id>
                <url>http://nexus-server/nexus/content/groups/public-snapshots</url>
                <releases>
                    <enabled>false</enabled>
                </releases>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
            </repository>
        </repositories>
    </profile>
</profiles>

Hope this help



回答2:

Does it show up if you use the nexus web interface to search for it? I've seen cases in our nexus install where an artifact looks like it's missing like this, but shows up in the search results. If I then download it via my browser from the search results, it magically starts working at the maven command line.

Not the robust solution you want to hear, I'm sure, but it's at least worth a try.



回答3:

If you've added the JBoss repository to Nexus, did you remember to configure your Public Repositories group to include it?

Here's a screenshot:



回答4:

Are you behind a corporate firewall? Perhaps a HTTP proxy needs to be configured within Nexus (See the Server admin screen)



回答5:

Ended up being a bad dependency. I had to add it manually to get it all working. Terrible!