Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to force Sonatype Nexus to update?

Tags:

I am trying to use onejar-maven-plugin in my pom.xml:

<plugin>
    <groupId>org.dstovall</groupId>
    <artifactId>onejar-maven-plugin</artifactId>
    <version>1.4.4</version>
    <executions>
        <execution>
            <configuration>
                <mainClass>com.exmaple.myproj.MpPort_MpSoapPort_Client</mainClass>
                <onejarVersion>0.97</onejarVersion>
                <attachToBuild>true</attachToBuild>
                <classifier>onejar</classifier>
            </configuration>
            <goals>
                <goal>one-jar</goal>
            </goals>
        </execution>
    </executions>
</plugin>

<pluginRepositories>
    <pluginRepository>
        <id>onejar-maven-plugin.googlecode.com</id>
        <url>http://onejar-maven-plugin.googlecode.com/svn/mavenrepo</url>
    </pluginRepository>
</pluginRepositories>

but for some reason, attempting to build it via the Eclipse Maven plugin (Maven install) results in BUILD ERROR:

Downloading: https://mynexus.example.com/nexus/content/repositories/central/org/dstovall/onejar-maven-plugin/1.4.4/onejar-maven-plugin-1.4.4.pom
[INFO] Unable to find resource 'org.dstovall:onejar-maven-plugin:pom:1.4.4' in repository onejar-maven-plugin.googlecode.com (http://onejar-maven-plugin.googlecode.com/svn/mavenrepo)
Downloading: https://mynexus.example.com/nexus/content/repositories/central/org/dstovall/onejar-maven-plugin/1.4.4/onejar-maven-plugin-1.4.4.pom
[INFO] Unable to find resource 'org.dstovall:onejar-maven-plugin:pom:1.4.4' in repository central (http://repo1.maven.org/maven2)
Downloading: https://mynexus.example.com/nexus/content/repositories/central/org/dstovall/onejar-maven-plugin/1.4.4/onejar-maven-plugin-1.4.4.pom
[INFO] Unable to find resource 'org.dstovall:onejar-maven-plugin:pom:1.4.4' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: org.dstovall:onejar-maven-plugin

Reason: POM 'org.dstovall:onejar-maven-plugin' not found in repository: Unable to download the artifact from any repository

  org.dstovall:onejar-maven-plugin:pom:1.4.4

from the specified remote repositories:
  Nexus (https://mynexus.example.com/nexus/content/repositories/central)

 for project org.dstovall:onejar-maven-plugin

So I manually downloaded onejar-maven-plugin.jar and install it through the command line and I seem to be getting a similar error:

C:\Users\daniel\myproj>mvn install:install-file -Dfile=onejar-maven-plugin-1.4.4.jar -DgroupId=com.jolira -DartifactId=onejar-maven-plugin -Dversion=1.4.4 -Dpackaging=jar
[INFO] Scanning for projects...
Downloading: https://mynexus.example.com/nexus/content/repositories/central/org/dstovall/onejar-maven-plugin/1.4.4/onejar-maven-plugin-1.4.4.pom
[INFO] Unable to find resource 'org.dstovall:onejar-maven-plugin:pom:1.4.4' in repository onejar-maven-plugin.googlecode.com (http://onejar-maven-plugin.googlecode.com/svn/mavenrepo)
Downloading: https://mynexus.example.com/nexus/content/repositories/central/org/dstovall/onejar-maven-plugin/1.4.4/onejar-maven-plugin-1.4.4.pom
[INFO] Unable to find resource 'org.dstovall:onejar-maven-plugin:pom:1.4.4' in repository central (http://repo1.maven.org/maven2)
Downloading: https://mynexus.example.com/nexus/content/repositories/central/org/dstovall/onejar-maven-plugin/1.4.4/onejar-maven-plugin-1.4.4.pom
[INFO] Unable to find resource 'org.dstovall:onejar-maven-plugin:pom:1.4.4' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: org.dstovall:onejar-maven-plugin

Reason: POM 'org.dstovall:onejar-maven-plugin' not found in repository: Unable to download the artifact from any repository

  org.dstovall:onejar-maven-plugin:pom:1.4.4

from the specified remote repositories:
  Nexus (https://mynexus.example.com/nexus/content/repositories/central)

 for project org.dstovall:onejar-maven-plugin

My understanding is that because we have a Nexus mirror which doesn't contain that particular artifact, things get confused.

So I tried following the instructions on How to force Sonatype Nexus Regenerate / Reindex its Metadata but the “Browse Index” tab has no such context menu! on our Sonatype Nexus.

enter image description here

I read here that "Nexus only caches artifacts that clients have requested. So you need to set up your project poms to request the proper versions". But that's exactly what I have been doing -- without any change in the outcome.

How do I get out of this "chicken & egg" situation and get this onejar-maven-plugin ver. 1.4.4 into my Nexus mirror?

(Alternatively, how do I get it into my local .m2 cache?)

like image 695
Withheld Avatar asked Nov 27 '13 20:11

Withheld


People also ask

What happens when the repository Manager is unable to reach a remote repository?

If the repository manager fails to locate a component, it will cache this result for a given number of minutes. In other words, if the repository manager can't find a component in a remote repository, it will not perform repeated attempts to resolve this component until the Not Found Cache TTL time has been exceeded.


1 Answers

You can force Maven to update and request dependencies again even if the local repo contains metadata about artifacts not be available with -U

mvn clean install -U 

should work.

Also you should change your settings.xml to point to the public group instead of just the central repo directly. More can be found in the Nexus book.

And you should note that the Central Repository does not have the onejar plugin you are trying to use. Check out the search results and see how the groupId is com.joilira and not org.dstovall

Further more if you really want to use the onejar plugin from org.dstovall you should add the url http://onejar-maven-plugin.googlecode.com/svn/mavenrepo/ as a proxy repository to Nexus, add it to the public group and then use the public group in your settings.xml

like image 161
Manfred Moser Avatar answered Sep 20 '22 19:09

Manfred Moser