我对 maven 很陌生,我在公司内部(档案)存储库上编写和发布的插件遇到了一些麻烦。
正如我所见,插件的构建和发布似乎在 repo 的 url 上有效:
- 回购目录已创建
- 该目录包含:
- pom 、 pom.sh1 、 pom.md5 文件
- jar 、 jar.sh1 、 jar.md5 文件
在我的插件的 pom.xml 文件中,我引用了我们内部 repo 的 url:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.myorg</groupId>
<artifactId>myorg-build-info-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>1.0.0</version>
<name>myorg-build-info-plugin Maven Mojo</name>
<url>labserver.myorg-domain.com:8380/archiva/repository/internal</url>
....
十 我在另一个 pom.xml 中引用了这个插件:
<plugin>
<groupId>com.morg</groupId>
<artifactId>myorg-build-info-plugin</artifactId>
<version>1.0.0</version>
...
我确实在同一个 pom.xml 中提供了内部仓库:
<repositories>
<repository>
<id>myorg-repo</id>
<name>Repository for Myorg Artifacts</name>
<url>http://labserver.myorg-domain.com:8380/archiva/repository/internal</url>
<layout>default</layout>
</repository>
最后,如果我对该 pom 文件执行 maven clean 操作(执行mvn clean -e),我收到以下错误:
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building com.myorg.projectname
[INFO] task-segment: [clean]
[INFO] ------------------------------------------------------------------------
Downloading: http://repo1.maven.org/maven2/com/myorg/myorg-build-info-plugin/1.0.0/myorg-build-info-plugin-1.0.0.pom
[INFO] Unable to find resource 'com.myorg:myorg-build-info-plugin:pom:1.0.0' in repository central (http://repo1.maven.org/maven2)
Downloading: http://labserver.myorg-domain.com:8380/archiva/repository/internal/com/myorg/myorg-build-info-plugin/1.0.0/myorg-build-info-plugin-1.0.0.pom
1K downloaded (myorg-build-info-plugin-1.0.0.pom)
Downloading: http://repo1.maven.org/maven2/com/myorg/myorg-build-info-plugin/1.0.0/myorg-build-info-plugin-1.0.0.jar
[INFO] Unable to find resource 'com.myorg:myorg-build-info-plugin:maven-plugin:1.0.0' in repository central (http://repo1.maven.org/maven2)
[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:
...
现在从我所看到的:
- pom 文件是从我们的内部仓库中正确获取的
- jar 文件获取失败,因为它试图从 http://repo1.maven.org/maven2获取它
我希望所有的回购都被扫描,尤其是文件中声明的内部回购。
显然,情况并非如此。
因此,如果有人对为什么会发生这种情况有任何线索,我将非常感谢您的帮助!
TIA,
PS:我使用 maven 2.2.1 和 JDK 1.6.029 的 debian