Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting Nexus to download dependencies from a repository with no .index file

I've just setup the latest version of Nexus for our company, and it's working great. We've added several 3rd party repositories, and one of them does not have an .index file present. So it appears that Nexus can't index it, nor can the local maven ask for deps in that repository. Definitely unfortunate.

Is there any way around this aside from downloading the deps manually and installing them in our 3rd party "hosted" repository?

The maven repo in question: http://wicketstuff.org/maven/repository

Thanks!

like image 982
kinabalu Avatar asked Mar 01 '23 02:03

kinabalu


1 Answers

(EDIT: Having reread my initial answer, I think it wasn't totally clear nor accurate so I'm editing it to clarify some part. Plus, the OP has added a comment that I wanted to answer too.)

So it appears that Nexus can't index it, nor can the local maven ask for deps in that repository.

I'm not sure what you mean be "Nexus can't index it". If the repository doesn't provide a Nexus Index, its content won't be searchable "by default". But Nexus is definitely able to index artifacts once they've been downloaded from this repository. Regarding the second part, "nor can the local maven ask for deps in that repository", are you sure of this?

To me, Nexus Indices (which are Lucene indices) are "just" a nice thing to make repositories searchable but a non indexed repository can certainly be proxyed (Nexus can't expect all repositories around the world to provide a Nexus index). So there must actually be something else wrong with your setup.

Assuming you want to use wicket SNAPSHOTS, I've setup Nexus and used the POM shown below:

<project>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mycompany.samples.wicket</groupId>
  <artifactId>nexus-wicket-testcase</artifactId>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>
  <name>nexus-wicket-testcase</name>
  <url>http://maven.apache.org</url>
  <dependencies>
    <dependency>
      <groupId>org.apache.wicket</groupId>
      <artifactId>wicket</artifactId>
      <version>1.5-SNAPSHOT</version>
    </dependency>
  </dependencies>
</project>

Then, I've added http://wicketstuff.org/maven/repository as Snapshot repository in Nexus and have listed it in the Public Repositories group. Finally, I've configured Maven as documented in Configuring Maven to Use a Single Nexus Group.

With this setup, I get the following output when running for example eclipse:eclipse:

$ mvn eclipse:eclipse
...
[INFO] snapshot org.apache.wicket:wicket:1.5-SNAPSHOT: checking for updates from central
Downloading: http://localhost:8081/nexus/content/groups/public/org/apache/wicket/wicket/1.5-SNAPSHOT/wicket-1.5-20091109.012145-88.pom
2K downloaded  (wicket-1.5-20091109.012145-88.pom)
[INFO] snapshot org.apache.wicket:wicket-parent:1.5-SNAPSHOT: checking for updates from central
Downloading: http://localhost:8081/nexus/content/groups/public/org/apache/wicket/wicket-parent/1.5-SNAPSHOT/wicket-parent-1.5-SNAPSHOT.pom
22K downloaded  (wicket-parent-1.5-SNAPSHOT.pom)
Downloading: http://localhost:8081/nexus/content/groups/public/org/slf4j/slf4j-api/1.5.8/slf4j-api-1.5.8.pom
2K downloaded  (slf4j-api-1.5.8.pom)
Downloading: http://localhost:8081/nexus/content/groups/public/org/slf4j/slf4j-parent/1.5.8/slf4j-parent-1.5.8.pom
7K downloaded  (slf4j-parent-1.5.8.pom)
Downloading: http://localhost:8081/nexus/content/groups/public/org/apache/wicket/wicket/1.5-SNAPSHOT/wicket-1.5-20091109.012145-88.jar
1944K downloaded  (wicket-1.5-20091109.012145-88.jar)
Downloading: http://localhost:8081/nexus/content/groups/public/org/slf4j/slf4j-api/1.5.8/slf4j-api-1.5.8.jar
22K downloaded  (slf4j-api-1.5.8.jar)
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2 minutes 2 seconds
[INFO] Finished at: Wed Nov 11 06:12:01 CET 2009
[INFO] Final Memory: 9M/79M
[INFO] ------------------------------------------------------------------------

Everything looks fine to me.


... but a local maven would definitely know how to get deps out of the repo, the groupid + artifactid + build number gives it the full path to the app.

Yes, that's why I think that you have a setup problem somewhere. Maven should be able to find a dependency (e.g. wicket) in the right repository if Maven and Nexus are properly configured as demonstrated. Double check your settings.xml and/or your dependencies definition.

In order for nexus to index it, it would have to crawl all the directory paths it found which it appears not to do

This is not how things work AFAIK. If a repository doesn't provide an index, Nexus can only index artifacts that have already been downloaded. Nexus doesn't crawl a repository.

like image 164
Pascal Thivent Avatar answered Mar 05 '23 17:03

Pascal Thivent