簡體   English   中英

無法構建應用程序獲取錯誤::找不到類型 jdk 的工具鏈

[英]Failed to Build Application Getting Error::No toolchain found for type jdk

我為此嘗試了不同的解決方案,但對我不起作用,

請查看錯誤日志和toolchain.xml文件。

這些是錯誤日志:

[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

 <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 路徑

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

請幫助解決問題的地方。 提前致謝。

將 pom 中的版本改為 1.8 而不是 jdk1.8.0_172

                <configuration>
                    <toolchains>
                        <jdk>
                            <version>1.8</version>
                            <vendor>sun</vendor>
                        </jdk>
                    </toolchains>
                </configuration>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM