maven-eclipse-plugin其他源目录无效

时间:2015-09-18 13:00:04

标签: 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配置为包含此目录。

感谢帮助。

1 个答案:

答案 0 :(得分:1)

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

<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?