No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? idea maven 打包報錯問題解決。


mvn clean install -X -Dmaven.test.skip=true -P dev 打包報錯:
No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

idea,項目,maven 也設置了統一的jdk,還是報錯,

解決方法1:
在maven的setting.xml 文件 <profiles> 標簽中加入指定JDK的版本,

<profile>     
      <id>JDK-1.8</id>       
      <activation>       
        <activeByDefault>true</activeByDefault>       
        <jdk>1.8</jdk>       
      </activation>       
      <properties>       
        <maven.compiler.source>1.8</maven.compiler.source>       
        <maven.compiler.target>1.8</maven.compiler.target>       
        <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>       
      </properties>       
    </profile>

 

解決方法2:

在項目的pom.xml 文件加入maven插件,<plugins>中加入jdk路徑
 <plugin>
                  <artifactId>maven-compiler-plugin</artifactId>
                  <version>3.1</version>
                  <configuration>
                        <fork>true</fork>
                        <executable>
                            C:\Program Files\Java\jdk1.8.0_181\bin\javac.exe(你的安裝路徑)
                        </executable>
                   </configuration>
       </plugin>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM