maven打包报错:Cannot find matching toolchain definitions for the following toolchain types

 

 

报错信息: 

[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>

 

修改后重新打包即可


————————————————
版权声明:本文为CSDN博主「Song_MJ」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/yiqiu3812/article/details/103298980/

posted @ 2022-09-02 19:04  kelelipeng  阅读(376)  评论(0编辑  收藏  举报