eclipse m2eclipse 问题 ArtifactTransferException - 但是 pom.xml 从命令行编译/安装
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13425941/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
m2eclipse issues ArtifactTransferException - But pom.xml compiles / installs from the command line
提问by PacificNW_Lover
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.cloudst</groupId>
<artifactId>cloudst</artifactId>
<version>0.1.2</version>
<packaging>jar</packaging>
<name>cloudst</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>com.springsource.repository.bundles.release</id>
<url>http://repository.springsource.com/maven/bundles/release/</url>
</repository>
<repository>
<id>EclipseLink</id>
<url>http://download.eclipse.org/rt/eclipselink/maven.repo</url>
</repository>
<repository>
<id>java.net2</id>
<name>Repository hosting the jee6 artifacts</name>
<url>http://download.java.net/maven/2</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.kitchen-eel</groupId>
<artifactId>json-schema-validator</artifactId>
<version>${kitchen-eel.version}</version>
</dependency>
<build>
<finalName>cloudst</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</build>
</project>
Am able to successfully clean, compile, and install this project from the command line using the standard mvn commands...
我能够使用标准的 mvn 命令从命令行成功地清理、编译和安装这个项目......
However, in Eclipse Juno's Problems pane, I have the following 2 errors:
但是,在 Eclipse Juno 的问题窗格中,我有以下 2 个错误:
Missing artifact org.kitchen-eel:json-schema-validator:jar:1.2.1 pom.xml /com.cloudst line 45 Maven Dependency Problem
ArtifactTransferException: Failure to transfer org.kitchen-eel:json-schema-validator:jar:1.2.1
缺少工件 org.kitchen-eel:json-schema-validator:jar:1.2.1 pom.xml /com.cloudst line 45 Maven Dependency Problem
ArtifactTransferException:无法传输 org.kitchen-eel:json-schema-validator:jar:1.2.1
from http://repo.maven.apache.org/maven2was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original error: Could not transfer artifact org.kitchen-eel:json-schema-validator:jar:1.2.1 from/to central (http://repo.maven.apache.org/maven2):
从http://repo.maven.apache.org/maven2缓存在本地存储库中,直到 Central 的更新间隔已过或强制更新,才会重新尝试解析。原始错误:无法将工件 org.kitchen-eel:json-schema-validator:jar:1.2.1 from/to central (http://repo.maven.apache.org/maven2) 传输:
Failed to transfer http://repo.maven.apache.org/maven2/org/kitchen-eel/json-schema-validator/1.2.1/json-schema-validator-1.2.1.jar.
Why does it work in the command line but m2eclipse is posting problems?
为什么它在命令行中工作但 m2eclipse 发布问题?
Thanks for taking the time to read this...
感谢您抽时间阅读...
回答by sri_bb
This is very short tip to resolve the error “ArtifactTransferException: Could not transfer artifact” that may occur in Maven project in Eclipse.
这是解决 Eclipse 中 Maven 项目中可能发生的错误“ArtifactTransferException:Could not transfer artifact”的非常简短的提示。
Steps to resolve:
解决步骤:
1. Open folder by running this text (without Quotes) in Search Explorer of Window “%USERPROFILE%\.m2″.
2. After running above command, “m2″ folder of maven will open. Now search for file (without Quotes) “*.lastUpdated”.
3. In this step, delete all the files found by running Step 2.
4. Now go to Eclipse project and select “Maven | Update Dependency” or “Maven | Update Project”.
Happy Coding.
快乐编码。
回答by Bananeweizen
If you get such a connection error for all newartifacts: m2eclipse uses an embedded Maven instance by default, not your external Maven installation. The internal Maven instance might not use the same Maven settings like your external one (e.g. %USERPROFILE%/.m2/settings.xml), which then might lead to the internal Maven instance not being able to connect through your proxy.
如果您对所有新工件都出现这样的连接错误:默认情况下,m2eclipse 使用嵌入式 Maven 实例,而不是您的外部 Maven 安装。内部 Maven 实例可能不会使用与外部设置相同的 Maven 设置(例如 %USERPROFILE%/.m2/settings.xml),这可能会导致内部 Maven 实例无法通过您的代理进行连接。
You can use the Eclipse preferences to add your external Maven installation and to have it be used for running Maven commands from inside Eclipse.
您可以使用 Eclipse 首选项来添加外部 Maven 安装,并将其用于从 Eclipse 内部运行 Maven 命令。
回答by Damith Ganegoda
This is my solution.
这是我的解决方案。
find jar libraries that error occurred and delete from .m2 repo. Then update project using m2eclipse. It works for me.
找到发生错误的 jar 库并从 .m2 存储库中删除。然后使用 m2eclipse 更新项目。这个对我有用。