You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Julien Martin <ba...@gmail.com> on 2014/03/04 12:33:19 UTC

Using filtered resources with the maven assembly plugin and the jar-with-dependencies descriptorRef

Hello,

I am trying to filter resources before they are "fed" to  the maven
assembly plugin (with a jar-with-dependencies) to no avail.

Here are the relevant portions of my POM.xml:

...

 <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>

...
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>target</outputDirectory>
                            <resources>
                                <resource>

<directory>misc/external-resources</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>dev</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>target/dev</outputDirectory>
                            <filters>

<filter>src/main/filters/dev.properties</filter>
                            </filters>
                        </configuration>
                    </execution>
                    <execution>
                        <id>prod</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>target/prod</outputDirectory>
                            <filters>

<filter>src/main/filters/prod.properties</filter>
                            </filters>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
...

            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <id>dev-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <configuration>
                            <archive>
                                <manifest>
                                    <addClasspath>true</addClasspath>
                                    <mainClass>com.ids.main.Main</mainClass>
                                </manifest>
                            </archive>
                            <descriptorRefs>

<descriptorRef>jar-with-dependencies</descriptorRef>
                            </descriptorRefs>
                            <filters>

<filter>src/main/filters/dev.properties</filter>
                            </filters>

<finalName>IDS-dev-${project.version}</finalName>
                            <appendAssemblyId>false</appendAssemblyId>
                        </configuration>
                    </execution>
                </executions>
            </plugin>


Can anyone please help?

Regards,

Julien.