gpt4 book ai didi

java - maven-antrun-plugin 出现 "Plugin execution not covered by lifecycle configuration"错误

转载 作者:行者123 更新时间:2023-11-30 07:34:32 25 4
gpt4 key购买 nike

我正在尝试使用以下命令从 POM 文件构建项目:

mvn clean install

但我不断收到此错误:

Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-antrun-plugin:1.3:run (execution: build, phase: compile)

Eclipse 的应用程序商店中似乎没有 Ant 插件。我该如何解决这个问题?

这是我的 pom.xml 文件的插件部分:

<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>build</id>
<phase>compile</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<!-- Use exec instead of ant as src/ant/.ant.properties needs to be read in -->
<exec executable="ant" osfamily="unix" dir="${basedir}/src" failonerror="true">
<arg line="jar" />
</exec>
<exec executable="cmd" osfamily="windows" dir="${basedir}/src" failonerror="true">
<arg value="/c" />
<arg value="ant.bat" />
<arg line="jar" />
</exec>
</tasks>
</configuration>
</execution>
</executions>
</plugin>

最佳答案

这是 M2Eclipse 的问题。您必须指定应执行目标 run。在 plugins 标记之前添加此代码:

<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<versionRange>[1.7,)</versionRange>
<goals>
<goal>run</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>

来源here

值得一提的是,我正在使用的插件代码如下。我使用部署阶段,但如果您愿意,您可以使用另一个阶段

<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<id>antrun.package</id>
<phase>deploy</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<mkdir dir="${destinationBasePath}/WEB-INF/classes"/>
<copy todir="${destinationBasePath}\WEB-INF\classes">
<fileset dir="${basedir}/target/classes" includes="**" />
</copy>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>

关于java - maven-antrun-plugin 出现 "Plugin execution not covered by lifecycle configuration"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35589416/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com