首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >未能生成应用程序获取错误::没有找到jdk类型的工具链

未能生成应用程序获取错误::没有找到jdk类型的工具链
EN

Stack Overflow用户
提问于 2018-10-05 06:13:18
回答 2查看 10K关注 0票数 3

我尝试过不同的解决方案,但对我来说没有用,

请查看错误日志和toolchain.xml文件。

这些是错误日志:

代码语言:javascript
复制
[INFO] --- maven-toolchains-plugin:1.1:toolchain (default) @ ad-api ---
[INFO] Required toolchain: jdk [ vendor='sun' version='1.8' ]
[ERROR] No toolchain found for type jdk
[ERROR] Cannot find matching toolchain definitions for the following toolchain types:
jdk [ vendor='sun' version='1.8' ]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.619 s
[INFO] Finished at: 2018-10-05T08:56:24+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-toolchains-plugin:1.1:toolchain (default) on project ad-api: Cannot find matching toolchain definitions for the following toolchain types:
[ERROR] jdk [ vendor='sun' version='1.8' ]
[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

当我将版本1.8更新为jdk1.8._172时出现以上错误

下面是我的pom.xml

代码语言:javascript
复制
 <plugins>

   <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
   </plugin>

   <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-toolchains-plugin</artifactId>
      <executions>
         <execution>
            <goals>
               <goal>toolchain</goal>
            </goals>
         </execution>
      </executions>
      <configuration>
         <toolchains>
            <jdk>
               <version>jdk1.8.0_172</version>
               <vendor>sun</vendor>
            </jdk>
         </toolchains>
      </configuration>
   </plugin>

   <plugin>
      <artifactId>maven-resources-plugin</artifactId>
      <configuration>
         <encoding>${project.build.sourceEncoding}</encoding>
      </configuration>
   </plugin>

</plugins>

我已经在toolchain.xml中定义了jdk路径。

代码语言:javascript
复制
<toolchains>
    <toolchain>
    <type>jdk</type>
    <provides>
      <version>1.8</version>
      <vendor>sun</vendor>
    </provides>
    <configuration>
      <jdkHome>C:\Program Files\Java\jdk1.8.0_172</jdkHome>
    </configuration>
  </toolchain>
</toolchains>

请帮助解决问题的地方。提前谢谢。

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2018-10-05 06:27:35

将pom中的版本更改为1.8而不是jdk1.8.0_172

代码语言:javascript
复制
                <configuration>
                    <toolchains>
                        <jdk>
                            <version>1.8</version>
                            <vendor>sun</vendor>
                        </jdk>
                    </toolchains>
                </configuration>
票数 1
EN

Stack Overflow用户

发布于 2022-04-19 02:43:47

仔细检查您的目录路径。关于文件位置和使用maven --toolchains C:\User\zzz\.m2\toolchains.xml clean install进行测试的两条评论帮助我看到,我的文件夹是"m2“而不是".m2”。

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

https://stackoverflow.com/questions/52659327

复制
相关文章

相似问题

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