0

我正在将项目转换为与 OSGi 兼容的组件并使用 Maven/Tycho 来执行此操作。我使用下面的插件来编译 Groovy 源文件,但之后编译的 JAR 包含源文件和类文件。我不希望 JAR 附带源文件。我需要为此做任何配置吗?

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <compilerId>groovy-eclipse-compiler</compilerId>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>groovy-eclipse-compiler</artifactId>
                    <version>2.7.0-01</version>
                    <exclusions>
                        <exclusion>
                            <groupId>org.codehaus.groovy</groupId>
                            <artifactId>groovy-eclipse-batch</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>
                <dependency>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>groovy-eclipse-batch</artifactId>
                    <version>2.1.3-01</version>
                </dependency>
            </dependencies>
        </plugin>
        <plugin>                
            <groupId>org.codehaus.groovy</groupId>
            <artifactId>groovy-eclipse-compiler</artifactId>
            <version>2.7.0-01</version>
            <extensions>true</extensions>                       
        </plugin>
    </plugins>
</build>
4

1 回答 1

0

not sure if you shouldn't be using tycho-compiler-plugin instead of maven-compiler-plugin (it is used anyway for maven packaging types eclipse-plugin and eclipse-test-plugin).

tycho-compiler-plugin has an "excludeResources" configuration

https://www.eclipse.org/tycho/sitedocs/tycho-compiler-plugin/compile-mojo.html#excludeResources

which you can use to exclude for example **/*.groovy files

Here is a scala example

https://github.com/muuki88/tycho/blob/master/pom.xml#L38

于 2014-08-22T09:23:34.323 回答