今天用idea2019創建了一個maven項目之後,執行mvn site指令,報錯:
[INFO] Could not build project for: maven-antrun-plugin:Some problems were encountered while processing the POMs:
[ERROR] ‘distributionManagement.status’ must not be specified. @ line 38, column 13
‘distributionManagement.status’ must not be specified. @ line 38, column 13
百度谷歌了半天,說是pom.xml出錯了,裏面不能設置’distributionManagement.status’ 屬性,但我全局搜索了pom.xml和settings.xml以及項目中所有的xml文件發現都沒有這個屬性。後來看到了一個答案,下面有人說可能是插件版本問題,雖然沒有將具體的解決方法,但試了試修改pom.xml中的插件版本,發現果然可行,具體操作如下:
1.找到完整的報錯信息,其中提到插件 ‘maven-antrun-plugin’,查看pom.xml,果然其中用了這個插件,
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.1</version>
</plugin>
2.看到版本是1.1,命令行運行mvn antrun:help,查看默認版本是多少,發現是1.3,修改pom.xml。
3.pom.xml中修改爲
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.3</version>
</plugin>
解決。
(當然這個問題也可能是pom中指定了’distributionManagement.status’ 屬性引起的,將這個屬性刪除即可)