【发布时间】:2011-03-12 12:12:29
【问题描述】:
我有一个 Nexus 实例,其 Maven 2 存储库托管在未连接 Internet 的公司开发域上。我需要使用 Sun 的 maven-jaxb-schemagen 插件,但是,它只能以 Maven 1 格式提供(以及许多其他 Maven 1 依赖项,所以这不是一次性的极端情况)。
我在 Nexus (maven1) 中创建了一个新的 Maven 1 托管存储库,然后也创建了一个 Maven1 到 Maven2 的虚拟存储库 (maven1as2)。因为一些所需的工件是快照,所以 maven1(以及扩展名为 maven1as2)的策略是 Snapshot。
我通过文件系统将所有 Maven 1 工件导入到此存储库的覆盖本地存储位置。
然后我将 maven1as2 添加到我的 Public Repositories 组。我发现的一些参考资料说 Nexus 不允许您浏览或搜索 Maven1 存储库。我的结果好坏参半。如果我在 Nexus 中选择 Public Repositories 或 maven1as2,我可以转到 Browse Storage 并深入到 com/sun/tools/ jxc/maven2/maven-jaxb-schemagen-plugin/1.3-SNAPSHOT/ 并查看 maven-jaxb-schemagen-plugin-1.3-SNAPSHOT.pom 文件及其校验和。但是,我无法查看应该存在并位于文件系统上的 JAR 工件。
当我尝试使用 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] ---------------------------------------------------------------------------
【问题讨论】: