我正在尝试使用解决方案described here来解决烦人的“生命周期配置未涵盖的插件执行:org.codehaus.mojo:build-helper-maven-plugin:1.7:add-source(执行: default,phase:generate-sources)“当我将以下插件放在我的pom.xml上时:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<phase>generate-sources</phase>
<goals><goal>add-source</goal></goals>
<configuration>
<sources>
<source>src/bootstrap/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
但是当我运行mvn clean install时,我得到了这个:
原因:在存储库中找不到POM'org.eclipse.m2e:lifecycle-mapping':无法从任何存储库下载工件
有没有人知道如何让m2e和maven开心?
答案 0 :(得分:108)
实际上不存在org.eclipse.m2e:lifecycle-mapping
插件。应该在<build><pluginManagement>
的{{1}}部分使用它。这样,它不会被Maven解决,但可以被m2e读取。
但是对你的问题更实际的解决方案是在eclipse中安装m2e build-helper连接器。您可以从pom.xml
&gt;安装它。 Window
&gt; Preferences
&gt; Maven
&gt; Discovery
。那样Open Catalog
将在eclipse中调用,而无需您更改build-helper-maven-plugin:add-sources
。
答案 1 :(得分:10)
尝试使用build/pluginManagement
部分,例如:
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.bsc.maven</groupId>
<artifactId>maven-processor-plugin</artifactId>
<versionRange>[2.0.2,)</versionRange>
<goals>
<goal>process</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
以下是在Eclipse中进行增量编译期间生成包清单的示例:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<versionRange>[1.0.0,)</versionRange>
<goals>
<goal>manifest</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
<configuration>
<instructions>
</instructions>
</configuration>
<executions>
<execution>
<id>manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
versionRange是必需的,如果省略m2e(从1.1.0开始)将抛出NullPointerException。
答案 2 :(得分:8)
您可以使用此虚拟插件:
mvn archetype:generate -DgroupId=org.eclipse.m2e -DartifactId=lifecycle-mapping -Dversion=1.0.0 -DarchetypeArtifactId=maven-archetype-mojo
生成项目后安装/部署它。
答案 3 :(得分:4)
我是这样做的:我把m2e的生命周期映射插件放在一个单独的配置文件中,而不是默认的&lt; build&gt;部分。在eclipse构建期间,通过m2e属性(而不是settings.xml中的手动激活或其他方式)自动激活配置文件。这将处理m2e案例,而命令行maven将简单地跳过配置文件和m2e生命周期映射插件而没有任何警告,并且每个人都很高兴。
<project>
...
<profiles>
...
<profile>
<id>m2e</id>
<!-- This profile is only active when the property "m2e.version"
is set, which is the case when building in Eclipse with m2e. -->
<activation>
<property>
<name>m2e.version</name>
</property>
</activation>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>...</groupId>
<artifactId>...</artifactId>
<versionRange>[0,)</versionRange>
<goals>
<goal>...</goal>
</goals>
</pluginExecutionFilter>
<action>
<!-- either <ignore> XOR <execute>,
you must remove the other one. -->
<!-- execute: tells m2e to run the execution just like command-line maven.
from m2e's point of view, this is not recommended, because it is not
deterministic and may make your eclipse unresponsive or behave strangely. -->
<execute>
<!-- runOnIncremental: tells m2e to run the plugin-execution
on each auto-build (true) or only on full-build (false). -->
<runOnIncremental>false</runOnIncremental>
</execute>
<!-- ignore: tells m2eclipse to skip the execution. -->
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
...
</profiles>
...
</project>
答案 4 :(得分:3)
我已经在m2e打开了一个(琐碎的)错误。如果您希望警告信息永远消失,请投票支持...
答案 5 :(得分:3)
我遇到了同样的问题,其中:
找不到处理build-helper-maven-plugin的市场条目:1.8:Eclipse中的add-source。有关详细信息,请参阅“帮助”。
并点击Window&gt;偏好&gt; Maven&gt;发现&gt;打开目录按钮将报告没有连接。
在Centos 6.4和OSX上从7u40更新到7u45解决了这个问题。
答案 6 :(得分:1)
Maven正在尝试下载m2e的生命周期映射工件,M2E使用它来确定如何在Eclipse中处理插件(添加源文件夹等)。由于某种原因,无法下载此工件。你有互联网连接吗?是否可以从存储库下载其他工件?代理设置?
有关Maven的更多详细信息,请尝试打开M2E调试输出(Settings / Maven / Debug Output复选框),它可能会为您提供有关无法从存储库下载的详细信息。
答案 7 :(得分:1)
m2e 1.7引入了new syntax for lifecycle mapping metadata,不再导致此警告:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<!-- This executes the goal in Eclipse on project import.
Other options like are available, eg ignore. -->
<?m2e execute?>
<phase>generate-sources</phase>
<goals><goal>add-source</goal></goals>
<configuration>
<sources>
<source>src/bootstrap/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
答案 8 :(得分:0)
这是因为缺少插件配置(根据vaadin's demo pom.xml评论):
此插件的配置用于存储Eclipse m2e设置 只要。它对Maven构建本身没有影响。
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e ettings 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>com.vaadin</groupId>
<artifactId>
vaadin-maven-plugin
</artifactId>
<versionRange>
[7.1.5,)
</versionRange>
<goals>
<goal>resources</goal>
<goal>update-widgetset</goal>
<goal>compile</goal>
<goal>update-theme</goal>
<goal>compile-theme</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
答案 9 :(得分:0)
令人惊讶的是,这三个步骤对我有帮助:
mvn clean
mvn package
mvn spring-boot:run
答案 10 :(得分:0)
这一步对我有效: 1.在eclipse上删除项目 2.重新导入项目 3.删除项目上的目标文件夹 4. mvn或mvnw install