基于maven的项目,使用各种maven plugin来完成开发中的各种工作,例如编译代码,打包,部署等等… 每个plugin包含许多的goal,用来做特定的事情。典型的基于java的maven项目就有 clean compile test package deploy等goal要执行。除了这些比较常见的goal之外,项目中还可以使用大量的第三方的plugin,甚至自己动手开发的plugin。
随之而来的问题是,在eclipse中编辑maven项目的时候,eclipse并不知道这些goal要做什么,通用的goal还好说,特殊用途的goal就没有办法了。所以m2eclipse这个集成maven到eclipse的plugin就提供了开发extra的能力,eclipse利用这些extra来完成本来在maven plugin要干的活。
如果eclipse没有办法知道某个goal要干什么,那么通常就会看到如下的错误信息:
Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-dependency-plugin:2.6:copy (execution: default, phase: validate)
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>create-mrapp-generated-classpath</id>
<phase>generate-test-resources</phase>
<goals>
<goal>build-classpath</goal>
</goals>
<configuration>
<!-- needed to run the unit test for DS to generate the required
classpath that is required in the env of the launch container in the mini
mr/yarn cluster -->
<outputFile>${project.build.directory}/test-classes/mrapp-generated-classpath</outputFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>create-mrapp-generated-classpath</id>
<phase>generate-test-resources</phase>
<goals>
<goal>build-classpath</goal>
</goals>
<configuration>
<!-- needed to run the unit test for DS to generate the required
classpath that is required in the env of the launch container in the mini
mr/yarn cluster -->
<outputFile>${project.build.directory}/test-classes/mrapp-generated-classpath</outputFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>create-mrapp-generated-classpath</id>
<phase>generate-test-resources</phase>
<goals>
<goal>build-classpath</goal>
</goals>
<configuration>
<!-- needed to run the unit test for DS to generate the required
classpath that is required in the env of the launch container in the mini
mr/yarn cluster -->
<outputFile>${project.build.directory}/test-classes/mrapp-generated-classpath</outputFile>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>