【发布时间】:2013-02-06 09:41:48
【问题描述】:
对于我的构建过程,我需要两个自定义 maven 插件 (see here)。使用 mvn install 将其部署到我的本地 maven 存储库时效果很好。
但是,我需要让我团队中的其他开发人员可以访问它并进行集成测试。
我注意到您可以在 github 上设置一个轻量级的 maven 存储库,这就是我现在所做的:https://github.com/rweng/mvn-repo
这适用于像 ch.yax.yocto.yocto-server 这样的普通依赖项,但是,它对我的插件失败并显示消息
[WARNING] The POM for com.arcanio.maven.plugin:velocity:jar:0.1-SNAPSHOT is missing, no dependency information available**
[ERROR] Plugin com.arcanio.maven.plugin:velocity:0.1-SNAPSHOT or one of its dependencies could not be resolved: Failed to read artifact descriptor for com.arcanio.maven.plugin:velocity:jar:0.1-SNAPSHOT: Could not find artifact com.arcanio.maven.plugin:velocity:pom:0.1-SNAPSHOT -> [Help 1]
我尝试通过file:/// 替换我的存储库部分中的 github url,尽管我怀疑问题出在此处。我也怀疑这是代理问题,因为许多用户报告了相同的错误。
mvn install 有可能部署 s.th。与我的部署命令不同
mvn -DaltDeploymentRepository=snapshot-repo::default::file:/Users/robin/Code/mvn-repo/ clean deploy
提前感谢任何提示如何解决这个问题。
编辑
我刚刚将插件从本地存储库移至 github 存储库,并注意到以下更改。
D com/arcanio/maven/plugin/maven-metadata.xml
D com/arcanio/maven/plugin/maven-metadata.xml.md5
D com/arcanio/maven/plugin/maven-metadata.xml.sha1
D com/arcanio/maven/plugin/velocity/0.1-SNAPSHOT/maven-metadata.xml
D com/arcanio/maven/plugin/velocity/0.1-SNAPSHOT/maven-metadata.xml.md5
D com/arcanio/maven/plugin/velocity/0.1-SNAPSHOT/maven-metadata.xml.sha1
D com/arcanio/maven/plugin/velocity/0.1-SNAPSHOT/velocity-0.1-20130206.084855-1.jar
D com/arcanio/maven/plugin/velocity/0.1-SNAPSHOT/velocity-0.1-20130206.084855-1.jar.md5
D com/arcanio/maven/plugin/velocity/0.1-SNAPSHOT/velocity-0.1-20130206.084855-1.jar.sha1
D com/arcanio/maven/plugin/velocity/0.1-SNAPSHOT/velocity-0.1-20130206.084855-1.pom
D com/arcanio/maven/plugin/velocity/0.1-SNAPSHOT/velocity-0.1-20130206.084855-1.pom.md5
D com/arcanio/maven/plugin/velocity/0.1-SNAPSHOT/velocity-0.1-20130206.084855-1.pom.sha1
D com/arcanio/maven/plugin/velocity/maven-metadata.xml
D com/arcanio/maven/plugin/velocity/maven-metadata.xml.md5
D com/arcanio/maven/plugin/velocity/maven-metadata.xml.sha1
?? com/arcanio/maven/plugin/maven-metadata-local.xml
?? com/arcanio/maven/plugin/velocity/0.1-SNAPSHOT/_maven.repositories
?? com/arcanio/maven/plugin/velocity/0.1-SNAPSHOT/maven-metadata-local.xml
?? com/arcanio/maven/plugin/velocity/0.1-SNAPSHOT/velocity-0.1-SNAPSHOT.jar
?? com/arcanio/maven/plugin/velocity/0.1-SNAPSHOT/velocity-0.1-SNAPSHOT.pom
?? com/arcanio/maven/plugin/velocity/maven-metadata-local.xml
所以mvn install 确实会产生不同的东西。有谁知道为什么?我认为mvn install 与mvn deploy 基本相同,但指向本地存储库。
编辑
使用mvn -DuniqueVersion=false 修复唯一版本。见here。
编辑
uniqueVersion=falsedoes not work anymore with maven 3。所以问题保持不变,在存储库中找不到时间戳版本。我想我可能错过了一个 artifactid-snapshot pom。
解决方案
找到解决方案here:
存储库必须添加为pluginRepository:
<pluginRepositories>
<pluginRepository>
<id>rweng-plugins</id>
<url>https://github.com/rweng/mvn-repo/raw/master</url>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
</snapshots>
</pluginRepository>
</pluginRepositories>
【问题讨论】:
标签: maven maven-3 maven-plugin