简体   繁体   中英

Create Maven Project with Nexus Repository OSS 3 [offline]

My problem is that I can't create a new Maven project after adding my Nexus repository to the .m2 settings.xml.

I've installed Nexus Repositoy Manager OSS 3.0.2 as my local Maven repository. I have a machine which is in offline mode and can not connect to the internet. What I can do is transfer data from an online machine to it thought. So I can deploy all necessary libraries on the online machine and just switch the /data folder later on.

Error after creating a new Maven project with Eclipse:

Could not calculate build plan: Plugin org.apache.maven.plugins:maven- >resources-plugin:2.6 or one of its dependencies could not be resolved: >Failed to read artifact descriptor for org.apache.maven.plugins:maven- >resources-plugin:jar:2.6

The maven-resources-plugin-2.6.jar is deployed/available on my Nexus Repository: Path org/apache/maven/plugins/maven-resources-plugin/2.6/maven-resources-plugin-2.6.jar

My Maven settings.xml (partly):

<mirrors>
<mirror>
  <!--This sends everything else to /public -->
  <id>nexus</id>
  <mirrorOf>*</mirrorOf>
  <url>http://localhost:8081/repository/maven-test/</url>
</mirror>
</mirrors>
...
<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>
...
<server>
 <id>nexus</id>
 <username>admin</username>
 <password>admin123</password>
</server>

As you can see my repository is named "maven-test". Is it normal that the Nexus repositories are not browseable by their URLs ( http://localhost:8081/repository/NAME_OF_REPO/ )?

Is there any documentation which Maven libraries are mandatory to create a simple Maven project. The minimum amount of .jars?

What I've tried so far:

  • created a simple Maven project on a internet connected machine and downloaded all necessary Libraries with: mvn dependency:go-offline . After that I deployed all .jars from my local m2 repository to Nexus (about 160 Jars - luckily I used a Shell script for the deployment). For the offline simulation I deleted my local repository and went offline. Now the error occurs after creating a new Maven project in Eclipse.

I'm using Maven 3.3.9 - Java 1.8 - Eclipse 4.4 - Mac OS

Please any help would be appreciated! Thanks

[Edit] forgot to upload the .pom files to Nexus. Clean install worked for a existing project. Still got the error after creating a new Maven project

Run a mvn clean install on the project without using the nexus tool.

This will download all the required jars and poms to your local repository as specified in your maven settings.xml

Copy all of these files to your offline nexus installation.

The caveat with any new projects you create each time is that they may require new jars and poms that weren't used by the first project and so were never downloaded and copied to your Nexus install which will give you issues.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM