无法使用eclipse Mars创建Maven项目

时间:2016-09-12 14:27:21

标签: eclipse maven selenium-webdriver maven-3 maven-assembly-plugin

我是Maven设置的新手在设置它时面临挑战。当eclipse运行配置来设置Maven时,它会抛出如下错误:

CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:3.1: ArtifactResolutionException: Failure to transfer org.apache.maven.plugins:maven-compiler-plugin:pom:3.1 from https://repo.maven.apache.org/maven2 was 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.apache.maven.plugins:maven-compiler-plugin:pom:3.1 from/to central (https://repo.maven.apache.org/maven2): connect timed out

我绝对可以手动下载https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-resources-plugin/2.6/资源,但看不懂连接定时错误。我已清理 .m2 文件夹&开始新鲜的maven项目配置&没运气。另外,我没有在.m2文件夹中看到setting.xml。欢迎任何建议。提前谢谢。

2 个答案:

答案 0 :(得分:1)

确保通过Window设置eclipse连接 - >偏好 - >网络连接,

还要检查窗口 - >偏好 - > Maven - >用户设置。如果存在指定的路径,例如“C:\ Users \ user.m2 \ settings.xml”,请确保它存在并正确填写,请尝试关注This Link

答案 1 :(得分:1)

确保已添加“Project-> Properties-> Java build path-> libraries”中的所有外部jar。 2)然后从'订单和导出选项卡 - >需要导出所有jar文件'。 3)然后确保已经从'pom.xml'文件中设置了所有依赖项。

<强>依赖关系

<groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>          
    <configuration>
        <source>1.7</source>
        <target>1.7</target>

确保其最新的源版本和目标版本。