简体   繁体   English

停止m2e以创建在build-helper-maven-plugin中指定的不存在的源文件夹

[英]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: 在我的项目的父pom中,我具有以下build-helper-maven-plugin设置:

<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. 这样,当我执行Maven-> Update project时,m2e将src / it / java文件夹添加到项目的源中。 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. 使用该父pom的大多数项目中都存在该文件夹,但是对于没有该文件夹的项目,m2e会创建该文件夹。 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? 如果不存在,有没有办法告诉eclipse / m2 / build-helper插件不创建源文件夹? I'm using eclipse Kepler and m2e 1.4 with build-helper connector 0.5. 我正在使用带有构建助手连接器0.5的eclipse Kepler和m2e 1.4。

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. 当我执行Maven->更新项目并取消选中“从pom更新项目配置”时,不会创建该文件夹,但是我宁愿告诉m2e不要创建该文件夹,而不是仅取消某些项目的选项。

This issue is not happening using an old version of the plugin (0.10.2) in eclipse Indigo. 在Eclipse Indigo中使用旧版本的插件(0.10.2)不会发生此问题。

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. m2e可以更轻松地拾取它,并且从专家的角度来看它将更加标准。 Here is a link to the entry to update: http://maven.apache.org/pom.html#Build_Element 这是要更新的条目的链接: 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. 如果您不选择不使用当前插件,则可以添加一个配置文件来激活您的当前插件,前提是您的文件夹存在于当前模块中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 build-helper-maven-plugin 添加额外的源 - build-helper-maven-plugin adding additional source 使用 build-helper-maven-plugin 添加生成的 Apache Avro 源 - Add generated Apache Avro source with build-helper-maven-plugin build-helper-maven-plugin导致AnnotationTypeMismatchException - build-helper-maven-plugin causing AnnotationTypeMismatchException m2e maven eclipse插件未配置构建路径 - m2e maven eclipse plugin not configure the build path 使用 build-helper-maven-plugin 从 Jar 中排除文件 - Excluding Files From Jar With build-helper-maven-plugin build-helper-maven-plugin add-test-resource错误 - build-helper-maven-plugin add-test-resource error 错误:生命周期配置未涵盖插件执行:org.codhaus.mojo:build-helper-maven-plugin:1.3:add-source - Error: plugin execution not covered by life cycle configuration:org.codhaus.mojo:build-helper-maven-plugin:1.3:add-source 为什么M2e插件在Maven jar项目的目标文件夹中构建为WEB-INF / classs? - Why does the m2e plugin build to a WEB-INF/classes in the target folder for a maven jar project? Maven build-helper-maven-plugin 正则表达式无法使用属性作为dependency.version - Maven build-helper-maven-plugin regex unable to use property as dependency.version Maven | 如何在Gradle中使用build-helper-maven-plugin? - Maven | How can I use build-helper-maven-plugin in Gradle?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM