首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在m2e中配置工具链插件/在Eclipse中安装maven

如何在m2e中配置工具链插件/在Eclipse中安装maven
EN

Stack Overflow用户
提问于 2017-01-03 23:12:54
回答 1查看 9K关注 0票数 7

目前,我正在使用安装在我的windows机器上的 Maven (Apache 3.3.9) & Java(Java : 1.8.0_91)。我有一个java应用程序,它是使用Java 1.6.0_31开发的。

由于Apache (3.3.9)与以前版本的不直接兼容(在1.8之前),所以我在Java1.6中包含了编译和运行项目的工具链插件。我可以使用命令提示符成功构建。

但是,当我试图使用带eclipse->Windows->Preferences->Maven->Installations,的eclipse m2e插件或通过使用添加外部maven(3.3.9)来构建相同的项目时,我将得到以下错误。

代码语言:javascript
复制
[WARNING] 
[WARNING] Some problems were encountered while building the effective settings
[WARNING] Expected root element 'settings' but found 'toolchains' (position: START_TAG seen ...OOLCHAINS/1.1.0 http://maven.apache.org/xsd/toolchains-1.1.0.xsd">... @45:114)  @ U:\POC\Repo\.m2\toolchains.xml, line 45, column 114
[WARNING] 
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Replenishment Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ Replenishment ---
[INFO] Deleting C:\Users\xagh9\workspace\Replenishment\target
[INFO] 
[INFO] --- maven-toolchains-plugin:1.1:toolchain (default) @ Replenishment ---
[INFO] Required toolchain: jdk [ vendor='sun' version='1.6' ]
[ERROR] No toolchain found for type jdk
[ERROR] Cannot find matching toolchain definitions for the following toolchain types:
jdk [ vendor='sun' version='1.6' ]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.105 s
[INFO] Finished at: 2017-01-04T12:02:08+11:00
[INFO] Final Memory: 8M/116M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-toolchains-plugin:1.1:toolchain (default) on project Replenishment: Cannot find matching toolchain definitions for the following toolchain types:
[ERROR] jdk [ vendor='sun' version='1.6' ]
[ERROR] Please make sure you define the required toolchains in your ~/.m2/toolchains.xml file.
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

注释:使用和Java_1.8我可以成功地构建项目而不需要工具链插件。但是随着工具链插件的配置,我面临着这个问题。有人能帮我解决这个问题吗。

必需的toolchains.xml既存在于maven配置文件夹中,也存在于存储库的.m2文件夹中。

更新: Maven编译器插件配置:

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-01-04 01:35:21

在eclipse中更改目标后的解决方案运行配置,如下所示。

问题是eclipse并不是自动读取toolchains.xml。我们必须在目标中手动指定。我通过引用这个链接修复了这个问题

票数 8
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41453789

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档