简体   繁体   中英

How to index a Maven repo without Nexus/Artifactory/etc?

I run my own little Maven repo for some open source. I have no dedicated server so I use a Google code repository , deploy to file system and then commit and push. Works perfect for me.

But some Maven tools are looking for a nexus-maven-repository-index.properties and the index (in GZ). I would like to generate this index to

  1. get rid of the warning that it's not here
  2. Maven doesn't try the repo for artefacts that are not there.

How can I do that? Is there a tool (Java main) that is able to generate an index? Also tips how to use the proper Nexus Jars with a little commandline tool are welcome.

I came across this post while I was searching for a solution to add a local repository to my Maven project using IntelliJ Idea.

Since Sonatype changed their paths and reorganized the downloads since the last post, here is an updated step-by-step tutorial to get your repository indexed for use with IntelliJ Idea:

  1. Download the latest stand-alone indexer from here .
  2. Extract it somewhere and go into this directory
  3. From the console, run this command: export REPODIR=/path/to/your/local/repo/ && java org.sonatype.nexus.index.cli.NexusIndexerCli -r $REPODIR -i $REPODIR/.index -d $REPODIR/.index -n localrepo
  4. In the directory .index within the repository directory, some files will be created including the file "nexus-maven-repository-index.gz" which is the file IntelliJ looks out for.

You can use the Maven Indexer CLI to product the index directly, but why bother hosting your own repo when OSS projects can use a hosted one for free?

http://nexus.sonatype.org/oss-repository-hosting.html

I was looking at maven indexer... but I am not sure what for is the last parameter indexDir in the method:

 public RepositoryIndexer createRepositoryIndexer(String repositoryId,
                                        File repositoryBasedir,
                                        File indexDir)

is it like starting point in the repositoryBasedir?

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