mavenjarmaven-dependency

Where to manually download the JARS from when Maven cannot find a dependency


I want to create a Maven webapp sample project on a dev machine without internet, but with access a Nexus repo via the local network. The Nexus repo is years old, so it has most dependencies, but not all.

I have set up maven that it uses the local Nexus and then I typed:

$ mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-webapp -DarchetypeVersion=1.4

Maven goes off and downloads what it can from the local Nexus, but then it fails with:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:2.4:generate (default-cli) on project standalone-pom: Execution default-cli of goal org.apache.maven.plugins:maven-archetype-plugin:2.4:generate failed: Plugin org.apache.maven.plugins:maven-archetype-plugin:2.4 or one of its dependencies could not be resolved: The following artifacts could not be resolved: org.codehaus.plexus:plexus-component-api:jar:1.0-alpha-16, org.codehaus.plexus:plexus-classworlds:jar:1.2-alpha-7: Failure to find org.codehaus.plexus:plexus-component-api:jar:1.0-alpha-16

Due to the fact that the machine is not connected to the internet and that I have no control over the Nexus repo (so cannot add jars to it), would need to download the depend JARs for org.codehaus.plexus:plexus-component-api and org.codehaus.plexus:plexus-classworlds manually (on another internet-connected computer).

Where on the Internet do I find them? -- I tried a search on https://jar-download.com/online-maven-download-tool.php. E.g. for org.codehaus.plexus:plexus-component-api I search with the following the XML snippet:

<dependency>
   <groupId>org.codehaus.plexus</groupId>
   <artifactId>plexus-component-api</artifactId>
   <version>1.0-alpha-16</version>
</dependency>

but this didn't yield any result.


Solution

  • You can use copy goal of dependency-plugin for download and copy artifacts:

    mvn org.apache.maven.plugins:maven-dependency-plugin:3.3.0:copy \
     -Dartifact=org.codehaus.plexus:plexus-component-api:1.0-alpha-16:jar \
     -DoutputDirectory=.
    

    You can also download manually from Maven Central repository, eg:

    https://repo.maven.apache.org/maven2/org/codehaus/plexus/plexus-component-api/1.0-alpha-16/