建立springboot 專案demo maven專案報錯 但是不影響程式執行
我在建立maven專案springboot的時候,雖然程式執行功能都沒有啥毛病 就是在專案左邊總是有一個小紅叉,後來我看了控制檯的問題裡面說明 大概意思就是jdk版本太低 於是我就去專門設定一下了jdk版本 ,然後就好了 ,強迫症的我,看到沒有紅叉叉,感覺賊爽,不知道還有沒有人跟我一樣的同感。
修改jdk版本有兩種方式:
Number One:
在maven的pom.xml中新增以下程式碼指定jdk版本
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
Number Two:
在maven的安裝目錄找到settings.xml檔案,在裡面新增如下程式碼
<profile>
<id>jdk-1.7</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>1.7</jdk>
</activation>
<properties>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
</properties>
</profile>
設定完成後,右鍵專案->maven->update project,這樣每次新建maven專案都預設為jdk1.7版本了