新建的maven項目默認jdk版本不匹配_01

新建的maven項目默認jdk版本不匹配

1.在maven的安裝目錄編輯文件conf/settings.xml文件,找到<profiles></profiles>標籤內增加以下內容:

    <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.打開eclipse->windows->preferences->Maven->User Settings窗口中選中UserSettings的“Browse”重新選擇

剛剛maven安裝目錄下編輯的settings.xml


3.eclipse重新新建maven項目發現jdk引用的是剛剛配置的1.8版本了

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章