题
我有一个Nexus实例,其中有2个存储库,该存储库托管在非互联网的公司发展领域。我需要使用 Maven-Jaxb-Schemagen 但是,来自Sun的插件仅以Maven 1格式提供(以及许多其他Maven 1依赖项,因此这不是一次性的边缘情况)。
我在nexus做了一个新的Maven 1托管存储库(Maven1),然后也制作了maven1-maven2虚拟存储库(maven1as2)。因为某些需要的工件是快照,所以 Maven1 (并扩展 maven1as2) 是 快照.
我通过文件系统将所有Maven 1工件导入到该存储库的本地存储位置。
然后我添加了 maven1as2 对我的 公共存储库 团体。我发现的一些参考文献说Nexus将不允许您浏览或搜索Maven1存储库。我的结果好坏参半。如果我选择 公共存储库 或者 maven1as2 在Nexus中,我可以去 浏览存储 然后钻到 com/sun/tools/jxc/maven2/maven-jaxb-schemagen-plugin/1.3-snapshot/ 并查看 maven-jaxb-schemagen-plugin-1.3-snapshot.pom 文件及其校验和。但是,我看不到 罐 应该在文件系统上存在的伪像。
当我尝试使用Maven构建时,我会得到以下内容:
$ mvn clean compile
[INFO] Scanning for projects...
[INFO] Reactor build order:
[INFO] MyProject
[INFO] MyModule1
[INFO] MyModule2
...
[INFO] ---------------------------------------------------------------------------
[INFO] Building MyProject
[INFO] task-segment: [clean, compile]
[INFO] ---------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] [cobertura:clean {execution: default}]
[INFO] No goals needed for project - skipping
[INFO] ---------------------------------------------------------------------------
[INFO] Building MyModule1
[INFO] task-segment: [clean, compile]
[INFO] ---------------------------------------------------------------------------
Downloading: http://my.nexus.server:8081/nexus/content/groups/public/com/sun/tools/jxc/maven2/maven-jaxb-schemagen-plugin/1.3-SNAPSHOT/maven-jaxb-schemagen-plugin-1.3-SNAPSHOT.pom
6K downloaded (maven-jaxb-schemagen-plugin-1.3-SNAPSHOT.pom)
[INFO] ---------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ---------------------------------------------------------------------------
[INFO] A required plugin was not found: Plugin could not be found - check that the goal name is correct: Unable to download the artifact from any repository
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=com.sun.tools.jxc.maven2 -DartifactId=maven-jaxb-schemagen-plugin -Dversion=1.3-SNAPSHOT -Dpackaging=maven-plugin -Dfile=path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=com.sun.tools.jxc.maven2 -DartifactId=maven-jaxb-schemagen-plugin -Dversion=1.3-SNAPSHOT -Dpackaging=maven-plugin -Dfile=path/to/file -Durl=[url] -DrepositoryId=[id]
com.sun.tools.jxc.maven2:maven-jaxb-schemagen-plugin:1.3-SNAPSHOT
from the specified remote repositories:
nexus (http://my.nexus.server:8081/nexus/content/groups/public)
com.sun.tools.jxc.maven2:maven-jaxb-schemagen-plugin:1.3-SNAPSHOT
from the specified remote repositories:
nexus (http://my.nexus.server:8081/nexus/content/groups/public)
[INFO] ---------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ---------------------------------------------------------------------------
[INFO] Total time: 2 seconds
[INFO] Finished at: Tue Jul 06 15:05:08 EDT 2010
[INFO] Final Memory: 7M/17M
[INFO] ---------------------------------------------------------------------------
解决方案
有时在使用M2Eclipse时会发生这种情况。您选择了依赖项,默认范围是POM而不是JAR。您没有显示POM文件。验证所有依赖性都是jar范围的。
其他提示
我了解到,大多数时候重建存储库的元数据有助于解决此类问题。我发现这很烦人,这是必要的。
- 选择存储库
- 在“浏览存储”选项卡中,打开了根节点的上下文菜单(有时它隐藏在Firefox默认上下文菜单后面 - 在这种情况下,按ESC有助于将Nexus上下文菜单带入视图)
- 选择重建元数据
在某些情况下,到期缓存和勒索也可能会有所帮助。
在大多数情况下,这些步骤并未在第一次尝试解决问题,但最终他们每次都解决了问题。
我在玻璃鱼2.1中经营Nexus作为一场战争