Maven - maven-remote-resources-plugin - resources end up in final build

300 views Asked by At

I am using maven-remote-resources-plugin to import resources from another JAR:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-remote-resources-plugin</artifactId>
            <version>1.5</version>
            <configuration>
                <resourceBundles>
                    <resourceBundle>x:y:1.0.0-SNAPSHOT</resourceBundle>
                </resourceBundles>
            </configuration>
            <executions>
                <execution>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>process</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

As you can see, this is done in the generate-sources phase. I need these resources for a generator, which generates compilable sources in target/generated-sources. This works great.

However, the imported resources are now also in the final WAR/JAR. This is not needed. I only need these resources during compilation, not at runtime.

Is there a clever way to exclude these imported resources in the final build?

1

There are 1 answers

0
Puce On BEST ANSWER

The process goal of the Maven Remote Resources Plugin has the properties attachToMain and attachToTest.

I guess setting them to false will also exclude them from packaging.