我正在尝试使用maven插件将maven java项目的源文件夹添加到Eclipse .
当尝试使用org.codehaus.mojo插件时,我收到以下错误
无法在项目应用程序框架上执行目标org.codehaus.mojo:build-helper-maven-plugin:1.7:add-source(default-cli):目标org.codehaus.mojo的参数'sources':build-helper -maven-plugin:1.7:add-source缺失或无效 - > [帮助1]
从阅读http://mojo.codehaus.org/build-helper-maven-plugin/usage.html上的文档来看,这应该是正确的吗?文件夹target / sources / mygeneratedfiles on存在 .
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>target/sources/mygeneratedfiles</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
1 回答
问题是,由于“相对较新的”生命周期映射规则,构建帮助程序插件通常太旧而无法与最新的maven版本(与m2e eclipse插件结合使用)一起使用 .
我通过为orgeclipse.m2e plugib的build-helper-maven-plugin添加lifecyclemapping配置解决了这个问题 . 见下文: