简体   繁体   English

如何在没有Nexus / Artifactory / etc的情况下索引Maven仓库?

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

I run my own little Maven repo for some open source. 我为一些开源运行我自己的小Maven仓库。 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). 但是一些Maven工具正在寻找nexus-maven-repository-index.properties和索引(在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. Maven没有尝试回购不存在的人工制品。

How can I do that? 我怎样才能做到这一点? Is there a tool (Java main) that is able to generate an index? 是否有能够生成索引的工具(Java main)? Also tips how to use the proper Nexus Jars with a little commandline tool are welcome. 还提示如何使用适当的Nexus Jars和一些命令行工具。

I came across this post while I was searching for a solution to add a local repository to my Maven project using IntelliJ Idea. 当我在寻找一个使用IntelliJ Idea为我的Maven项目添加本地存储库的解决方案时,我遇到了这篇文章。

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: 由于Sonatype改变了他们的路径并重新组织了自上一篇文章以来的下载,这里有一个更新的分步教程,可以将您的存储库编入索引,以便与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 在控制台中,运行以下命令: 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. 在存储库目录中的目录.index中,将创建一些文件,包括文件“nexus-maven-repository-index.gz”,这是IntelliJ要查找的文件。

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? 您可以使用Maven Indexer CLI直接生成索引,但是当OSS项目可以免费使用托管版本时,为什么还要托管您自己的仓库呢?

http://nexus.sonatype.org/oss-repository-hosting.html 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: 我正在看maven索引器......但是我不确定该方法中的最后一个参数indexDir是什么:

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

is it like starting point in the repositoryBasedir? 它就像repositoryBasedir中的起点一样?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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