报错信息:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-toolchains-plugin:1.1:toolchain (default) on project myfile: 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.
解决方法:
注意:以下地址和jdkHome仅为个人环境地址,不通用
在C:\Users\user\.m2新建toolchains.xml文件(toolchains.xml文件在maven的安装目录的conf文件夹中,可以把它复制过去后再修改)
文件内容:
<?xml version="1.0" encoding="UTF-8"?>
<toolchains xmlns="http://maven.apache.org/TOOLCHAINS/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/TOOLCHAINS/1.1.0 http://maven.apache.org/xsd/toolchains-1.1.0.xsd">
<toolchain>
<type>jdk</type>
<provides>
<version>1.7</version>
<vendor>oracle</vendor>
</provides>
<configuration>
<jdkHome>D:\devtools\Java\jdk1.7.0_80</jdkHome>
</configuration>
</toolchain>
</toolchains>
修改后重新打包即可