Usage of maven Build Helper Maven Plugin

后端 未结 1 1374
天涯浪人
天涯浪人 2020-12-16 14:51

I\'m attempting to add a source folder for maven java project to Eclipse using a maven plugin.

When trying to use the org.codehaus.mojo plugin I receive the followin

相关标签:
1条回答
  • 2020-12-16 15:22

    The problem is that the build helper plugin is in general too old to be used with the newest maven versions (in combination with the m2e eclipse plugin), because of the "relative new" Lifecycle-mapping rules.

    I solved this issue by adding a lifecyclemapping configuration for the build-helper-maven-plugin for the orgeclipse.m2e plugib. 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>
    
    0 讨论(0)
提交回复
热议问题