maven中遇到的一些問題總結

一、 maven錯誤提示及解決方法:java

maven install 出現錯誤提示: Build errors for carmall-manager; org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.3:enforce (enforce-banned-dependencies) on project carmall-manager: Execution enforce-banned-dependencies of goal org.apache.maven.plugins:maven-enforcer-plugin:1.3:enforce failed: An API incompatibility was encountered while executing org.apache.maven.plugins:maven-enforcer-plugin:1.3:enforce: java.lang.NoSuchMethodError: org.apache.maven.project.MavenProject.getProjectBuilderConfiguration()Lorg/apache/maven/project/ProjectBuilderConfiguration;

可能的緣由: 有可能你在使用的版本是maven3.X,其執行maven-ant-plugin的行爲和maven2.x有必定的不一樣,須要引入pluginManagement

解決方法:在pom.xml中引入:<pluginManagement></pluginManagement>
 
以前的內容:
 <build>
   <plugins>
      <plugin></plugin>
      ...
       <plugin></plugin>
    </plugins>
</build>
修改後的內容:
 <build>
   <pluginManagement>
   <plugins>
      <plugin></plugin>
      ...
       <plugin></plugin>
    </plugins>
</pluginManagement>
</build>
相關文章
相關標籤/搜索