Using maven Build Helper Maven Plugin

I am trying to add the source folder for a maven java project in Eclipse using the maven plugin.

When I try to use the org.codehaus.mojo plugin, I get the following error

Failed to fulfill the target org.codehaus.mojo: build-helper-maven-plugin: 1.7: add-source (default-cli) in the project infrastructure project: source parameters for the target org.codehaus.mojo: build-helper- maven-plugin: 1.7: add-source missing or invalid β†’ [Help 1]

From reading documents at http://mojo.codehaus.org/build-helper-maven-plugin/usage.html, should this be correct? The target / sources / mygeneratedfiles folder is available.

<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> 
+13
maven m2e
May 24 '12 at 9:40
source share
1 answer

The problem is that the built-in build plugin is too old to be used with the latest maven versions (combined with the m2e eclipse plugin) due to the "relative new Lifecycle display rules".

I solved this problem by adding a lifecyclemapping configuration for the build-helper-maven module for the orgeclipse.m2e plugin. see below:

  <plugin> <groupId>org.eclipse.m2e</groupId> <artifactId>lifecycle-mapping</artifactId> <version>1.0.0</version> <configuration> <lifecycleMappingMetadata> <pluginExecutions> <pluginExecution> <pluginExecutionFilter> <groupId>org.codehaus.mojo</groupId> <artifactId>build-helper-maven-plugin</artifactId> <versionRange>[1.0,)</versionRange> <goals> <goal>add-source</goal> <goal>add-test-source</goal> <goal>add-resource</goal> <goal>add-test-resource</goal> <goal>maven-version</goal> <goal>parse-version</goal> </goals> </pluginExecutionFilter> <action> <execute> <runOnConfiguration>true</runOnConfiguration> <runOnIncremental>true</runOnIncremental> </execute> </action> </pluginExecution> </pluginExecutions> </lifecycleMappingMetadata> </configuration> </plugin> 
+13
Feb 18 '13 at 14:22
source share



All Articles