9

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.

carlspring
  • 31,231
  • 29
  • 115
  • 197
Peter Kofler
  • 9,252
  • 8
  • 51
  • 79

3 Answers3

11

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.
Björn Jacobs
  • 4,033
  • 4
  • 28
  • 47
  • 7
    You don't have to extract the jar, instead start it by executing `java -jar nexus-indexer-3.0.4-cli.jar` – Dag Dec 20 '13 at 23:01
  • I'm confused about nexus in relation to intellij, does intellij expect anyone using its maven functionality to also use nexus to generate these indexes? is nexus required? – Alkanshel Jul 25 '19 at 06:31
3

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

Brian Fox
  • 6,782
  • 4
  • 27
  • 31
  • 1
    It's the `Nexus Indexer CLI` available at http://nexus.sonatype.org/downloads/indexer/ Works perfectly. Thanks. – Peter Kofler Mar 19 '11 at 23:14
  • here's some explanation of the CLI options https://docs.sonatype.org/display/M2ECLIPSE/Nexus+Indexer – Toby Jan 28 '12 at 18:03
0

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?

Curamrda
  • 81
  • 1
  • 3
  • `indexDir` is the dir for the index files, usually `.index` directly below `releases` and `snapshots` folders each. – Peter Kofler Mar 02 '15 at 14:26