简体   繁体   中英

Stopping m2e to create non-existing source folders specified in build-helper-maven-plugin

In the parent pom of my projects I've the following build-helper-maven-plugin setup:

<plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.5</version>
            <executions>
                <execution>
                    <id>add-test-source</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>add-test-source</goal>
                    </goals>
                    <configuration>
                        <sources>
                            <source>src/it/java</source>
                        </sources>
                    </configuration>
                </execution>
            </executions>
        </plugin>

so that when I do Maven -> Update project, m2e adds the src/it/java folder to the sources of the project. That folder exists in most of the projects using that parent pom, but for the projects that don't have the folder, m2e will create it. I would like that folder to not be created. Is there a way to tell eclipse/m2/build-helper plugin to not create the source folder if does not exist? I'm using eclipse Kepler and m2e 1.4 with build-helper connector 0.5.

When I do Maven -> Update project and untick the "Update project configuration from pom", then the folder is not created, but I would rather tell m2e not to create the folder instead of unticking the option for certain projects only.

This issue is not happening using an old version of the plugin (0.10.2) in eclipse Indigo.

why don't you update the required projects folder's path instead of using a plugin to do it ?

m2e will pick it up more easily, and it will be more standard from a maven point of view. Here is a link to the entry to update: http://maven.apache.org/pom.html#Build_Element

If not using your current plugin is not an option you could add a profile which activates your current plugin, only if your folder exist in the current module.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM