描述:
在项目web-demo上执行目标org.apache.maven.plugins:maven-war:2.2:war失败:无法加载插件org.apache.maven.plugins:maven-war:2.2中的mojo 'war',因为API不兼容:org.codehaus.plexus.component.repository. exception.com componentlookupexception:无法访问属性的默认字段
解决办法:
在 pom.xml 文件的中添加如下插件:
<build> | |
<!-- To define the plugin version in your parent POM --> | |
<pluginManagement> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-war-plugin</artifactId> | |
<version>3.3.1</version> | |
</plugin> | |
</plugins> | |
</pluginManagement> | |
<!-- To use the plugin goals in your POM or parent POM --> | |
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-war-plugin</artifactId> | |
<version>3.3.1</version> | |
</plugin> | |
</plugins> | |
</build> |
可以查找在目录位置
maven Repository: org.apache.maven.plugins.maven-war-plugin
按照导入 Build 的常规操作将其导入到报错项目的 pom 中
格式:
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-war-plugin</artifactId> | |
<version>3.3.1</version> | |
</plugin> | |
</plugins> |
- 配置忽略 web.xml 文件
<plugins> | |
<plugin> | |
<groupId>org.apache.maven.plugins</groupId> | |
<artifactId>maven-war-plugin</artifactId> | |
<version>3.3.1</version> | |
<configuration> | |
<!-- 忽略 web.xml 的检查 --> | |
<failOnMissingWebXml>false</failOnMissingWebXml> | |
</configuration> | |
</plugin> | |
</plugins> |