java - maven-eclipse-plugin 附加源目录不起作用

标签 java eclipse maven

我已经放入了 pom.xml:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-eclipse-plugin</artifactId>
    <version>2.10</version>
    <configuration>
        <sourceIncludes>
            <sourceInclude>target/generated-test-sources/protobuf/java/**</sourceInclude>
        </sourceIncludes>
    </configuration>
</plugin>

但是当我运行时:

mvn eclipse:eclipse -Dwtpversion=2.0 install

它不会配置 .classpath 来包含此目录。

感谢帮助。

最佳答案

我找到了另一种方法来实现这个目标:

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

来源:How to add an extra source directory for maven to compile and include in the build jar?

关于java - maven-eclipse-plugin 附加源目录不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32652684/

相关文章:

java - 如何使用maven pax :provision加速部署

java - XSD 未验证 - udemy 28 分钟内

c# - 将 c# 数据类型转换为等效的 java 数据类型

java - 资源为空时锁定线程

java - 是否可以从 Java 或 C# 发送 LiveMeeting 邀请?

java - Eclipse AbstractTextEditor 不可编辑

java - 如何在 java 中使用 fiddler 捕获 https

Android LogCat 不适用于模拟器

java - 分组多级ArrayList jasperreports

spring - Maven Spring Boot预集成测试超时错误