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

落爺英雄遲暮 提交于 2020-01-12 04:58:07

问题


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.


回答1:


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




回答2:


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.



回答3:


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?



来源:https://stackoverflow.com/questions/5349261/how-to-index-a-maven-repo-without-nexus-artifactory-etc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!