我正在尝试在我的pom.xml中使用onejar-maven-plugin:
<plugin>
<groupId>org.dstovall</groupId>
<artifactId>onejar-maven-plugin</artifactId>
<version>1.4.4</version>
<executions>
<execution>
<configuration>
<mainClass>com.exmaple.myproj.MpPort_MpSoapPort_Client</mainClass>
<onejarVersion>0.97</onejarVersion>
<attachToBuild>true</attachToBuild>
<classifier>onejar</classifier>
</configuration>
<goals>
<goal>one-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<pluginRepositories>
<pluginRepository>
<id>onejar-maven-plugin.googlecode.com</id>
<url>http://onejar-maven-plugin.googlecode.com/svn/mavenrepo</url>
</pluginRepository>
</pluginRepositories>
但出于某种原因,尝试通过Eclipse Maven插件(Maven安装)构建它会导致BUILD ERROR:
Downloading: https://mynexus.example.com/nexus/content/repositories/central/org/dstovall/onejar-maven-plugin/1.4.4/onejar-maven-plugin-1.4.4.pom
[INFO] Unable to find resource 'org.dstovall:onejar-maven-plugin:pom:1.4.4' in repository onejar-maven-plugin.googlecode.com (http://onejar-maven-plugin.googlecode.com/svn/mavenrepo)
Downloading: https://mynexus.example.com/nexus/content/repositories/central/org/dstovall/onejar-maven-plugin/1.4.4/onejar-maven-plugin-1.4.4.pom
[INFO] Unable to find resource 'org.dstovall:onejar-maven-plugin:pom:1.4.4' in repository central (http://repo1.maven.org/maven2)
Downloading: https://mynexus.example.com/nexus/content/repositories/central/org/dstovall/onejar-maven-plugin/1.4.4/onejar-maven-plugin-1.4.4.pom
[INFO] Unable to find resource 'org.dstovall:onejar-maven-plugin:pom:1.4.4' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: org.dstovall:onejar-maven-plugin
Reason: POM 'org.dstovall:onejar-maven-plugin' not found in repository: Unable to download the artifact from any repository
org.dstovall:onejar-maven-plugin:pom:1.4.4
from the specified remote repositories:
Nexus (https://mynexus.example.com/nexus/content/repositories/central)
for project org.dstovall:onejar-maven-plugin
所以我手动下载onejar-maven-plugin.jar并通过命令行安装它,我似乎遇到了类似的错误:
C:\Users\daniel\myproj>mvn install:install-file -Dfile=onejar-maven-plugin-1.4.4.jar -DgroupId=com.jolira -DartifactId=onejar-maven-plugin -Dversion=1.4.4 -Dpackaging=jar
[INFO] Scanning for projects...
Downloading: https://mynexus.example.com/nexus/content/repositories/central/org/dstovall/onejar-maven-plugin/1.4.4/onejar-maven-plugin-1.4.4.pom
[INFO] Unable to find resource 'org.dstovall:onejar-maven-plugin:pom:1.4.4' in repository onejar-maven-plugin.googlecode.com (http://onejar-maven-plugin.googlecode.com/svn/mavenrepo)
Downloading: https://mynexus.example.com/nexus/content/repositories/central/org/dstovall/onejar-maven-plugin/1.4.4/onejar-maven-plugin-1.4.4.pom
[INFO] Unable to find resource 'org.dstovall:onejar-maven-plugin:pom:1.4.4' in repository central (http://repo1.maven.org/maven2)
Downloading: https://mynexus.example.com/nexus/content/repositories/central/org/dstovall/onejar-maven-plugin/1.4.4/onejar-maven-plugin-1.4.4.pom
[INFO] Unable to find resource 'org.dstovall:onejar-maven-plugin:pom:1.4.4' in repository central (http://repo1.maven.org/maven2)
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: org.dstovall:onejar-maven-plugin
Reason: POM 'org.dstovall:onejar-maven-plugin' not found in repository: Unable to download the artifact from any repository
org.dstovall:onejar-maven-plugin:pom:1.4.4
from the specified remote repositories:
Nexus (https://mynexus.example.com/nexus/content/repositories/central)
for project org.dstovall:onejar-maven-plugin
我的理解是因为我们有一个不包含特定神器的Nexus镜像,所以会让事情变得混乱。
所以我尝试按照How to force Sonatype Nexus Regenerate / Reindex its Metadata上的说明进行操作,但是“浏览索引”标签在我们的Sonatype Nexus上没有这样的上下文菜单!。
我读到here“Nexus只缓存客户请求的工件。因此,您需要设置项目poms以请求正确的版本”。但是这正是我一直在做的事情 - 结果没有任何改变。
如何摆脱这种“鸡蛋和鸡蛋”的情况并获得这个onejar-maven-plugin ver。 1.4.4进入我的Nexus镜子?
(或者,如何将其放入我的本地.m2缓存中?)
答案 0 :(得分:23)
即使本地存储包含有关-U
不可用的工件的元数据,您也可以强制Maven再次更新和请求依赖关系mvn clean install -U
应该有效。
此外,您应该将settings.xml
更改为指向公共群组,而不是直接指向中央群组。可以找到更多in the Nexus book。
您应该注意,Central Repository没有您尝试使用的onejar
插件。查看search results,看看groupId
是com.joilira
而不是org.dstovall
如果你真的想使用onejar
中的org.dstovall
插件,你应该将网址http://onejar-maven-plugin.googlecode.com/svn/mavenrepo/作为代理存储库添加到Nexus,将其添加到公共群组,然后再使用您settings.xml