eclipse 建立的maven項目debug出現Perhaps you are running on a JRE rather than a JDK?問題

我在打包maven項目的時候報了這個錯spring

致使打包失敗,百度了No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK 後上說是eclipse maven環境裏沒給編譯器,可能你是用jre,但須要jdkapache

百度上說eclipse默認是運行在jre上的,可是maven插件須要使用jdk,所以須要在eclipse修改Installed JRES 位置在-->【Window】-->【Prefrences】-->【Java】-->【Installed JREs】eclipse

技術分享

而後刷新項目,但是仍然包這個錯,maven

忽然想到maven項目能夠配置jdk 因而就在pom.xml裏添加ide

<plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <fork>true</fork>
                </configuration>
            </plugin>
            
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>spring-boot

從新刷新運行後成功this

相關文章
相關標籤/搜索