1. 程式人生 > 實用技巧 >Eclipse Sts pom.xml第一行報錯 unkown (springboot 專案)

Eclipse Sts pom.xml第一行報錯 unkown (springboot 專案)

sts的springboot專案,在沒有錯誤的時候,一直報紅。

提示: Unkown

體驗不太好。

參見了:https://zhuanlan.zhihu.com/p/83025786

作者是在pom.xml中增加:

<properties>

<maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>

</properties>

解決了。

但是我想不可能每一次有springboot專案都設定這個吧。所以在maven的settings.xml寫配置解決這個問題。

eclispe maven預設配置檔案在{user.dir}/.m2/settings.xml

1. 編輯該xml,在profiles節點下增加profile:

    <profile>
      <id>spring-boot-env</id>
      <activation>
<!-- jdk1.8時生效 -->
<jdk>1.8</jdk> </activation> <properties> <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version
> </properties> </profile>

2. 解開activeProfiles節點註釋,啟用該profile:

  <activeProfiles>
    <activeProfile>spring-boot-env</activeProfile>
  </activeProfiles>

Alt+f5更新工程,搞定嘿嘿。