我正在尝试在我的Maven项目上运行 mvn clean package ,但它失败并显示消息:
工件net.ezswitch的“缺少必需的工件”:ResourcesComponent:jar:0.0.14
我已经将 settings.xml 配置为包含我的远程存储库,如果我在我的浏览器中导航,我实际上可以在我的存储库中找到这个Jar,但Maven不能以某种方式。
我已经检查过我正在运行的Maven版本是我编辑过的settings.xml文件生效的版本,因为如果我禁用我在那里配置的配置文件,Maven就会失败了消息。
我在MAC OS X Lion上使用Maven 2.2.1。
这是我的settings.xml:
<localRepository>/Users/hordine/.m2/repository</localRepository>
<servers>
<server>
<id>LiquixRepository</id>
<username>henrique</username>
<password>xxxxx</password>
<configuration>
<httpConfiguration>
<put>
<params>
<param>
<name>http.authentication.preemptive</name>
<value>%b,true</value>
</param>
</params>
</put>
</httpConfiguration>
</configuration>
</server>
<server>
<id>dev.liquix.eu</id>
<username>henrique</username>
<password>xxxxx</password>
</server>
<server>
<id>ezpay-dev.liquix.eu</id>
<username>henrique</username>
<password>xxxxx</password>
</server>
</servers>
<profiles>
<profile>
<id>ezswitch</id>
<properties>
<tomcat.home>/System/Library/tomcat</tomcat.home>
<subversion.user>henrique</subversion.user>
<subversion.password>xxxxx</subversion.password>
</properties>
<activation>
<jdk>1.6</jdk>
</activation>
<repositories>
<repository>
<id>central</id>
<name>EzSwitch Cache</name>
<layout>default</layout>
<url>http://ezpay-dev.liquix.eu:9998/repository</url>
</repository>
<repository>
<id>central_maven1</id>
<name>EzSwitch Cache2</name>
<layout>legacy</layout>
<url>http://ezpay-dev.liquix.eu:9998/repository</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<name>EZswitch</name>
<url>http://ezpay-dev.liquix.eu:9998/repository</url>
<snapshots>
</snapshots>
<releases>
</releases>
</pluginRepository>
</pluginRepositories>
</profile>
</profiles>
<activeProfiles>
<activeProfile>ezswitch</activeProfile>
</activeProfiles>
我收到的整个错误消息是:
[INFO] ------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.lifecycle.LifecycleExecutionException: Missing:
----------
1) net.ezswitch:ResourcesComponent:jar:0.0.14
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=net.ezswitch -DartifactId=ResourcesComponent -Dversion=0.0.14 -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=net.ezswitch -DartifactId=ResourcesComponent -Dversion=0.0.14 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) eu.liquix:RegistrationSolution:war:0.4.60-SNAPSHOT
2) net.ezswitch:ResourcesComponent:jar:0.0.14
----------
1 required artifact is missing.
for artifact:
eu.liquix:RegistrationSolution:war:0.4.60-SNAPSHOT
from the specified remote repositories:
central (http://ezpay-dev.liquix.eu:9998/repository),
central_maven1 (http://ezpay-dev.liquix.eu:9998/repository)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:711)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
但如果我通过浏览器导航到该位置,我可以在以下位置看到神器:
我会感激任何帮助。提前谢谢。
Henrique Ordine
答案 0 :(得分:4)
显然错误消息“缺少必需的工件”隐藏了实际的根本原因,这在消息中是不可见的。在(-X选项)上运行带有调试消息的Maven将打印出更多详细信息,以便更详细地了解问题所在。
为了将来参考,这次错误是
[WARNING] Unable to get resource 'net.ezswitch:ResourcesComponent:pom:0.0.14' from repository central (ezpay-dev.liquix.eu:9998/repository):
Specified destination directory cannot be created: /Users/hordine/.m2/repository/net/ezswitch/ResourcesComponent/0.0.14
没有调试标志,这是不可见的。
答案 1 :(得分:1)
如果您还没有,请尝试一下:
mvn -U clean package
另外更新所有快照版本,如果它们自Maven每天一次快照检查后新部署到存储库,这也将迫使Maven更新其他缓存的repo分辨率,例如404。
答案 2 :(得分:1)
刚出现这个问题。在我的Mac上经历了这么多解决方案。最后改变了我的
〜/ .m2目录/ settings.xml中
改变了这个:
<localRepository>${USER.HOME}/.m2/repository</localRepository>
到此:
<localRepository>${env.HOME}/.m2/repository</localRepository>
您可以通过输入终端
来查看您在Mac上玩的所有属性 export