I ended-up using a combination of resources and dependency plugins, this
did what I wanted:
<!-- Setup the resources plugin to exclude a local log4j.xml file when
packaging the rpm -->
<resources>
<resource>
<directory>${project.build.directory}/shared-resources/</directory>
<filtering>true</filtering>
<includes>
<include>log4j.xml</include>
<include>logPurge.cron</include>
</includes>
</resource>
<resource>
<directory>${basedir}/src/main/resources/</directory>
<filtering>true</filtering>
<excludes>
<exclude>log4j.xml</exclude>
</excludes>
</resource>
</resources>
...
<!-- This plugin grabs the resources out of the
my-commons-logging-resources jar -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.5.1</version>
<executions>
<execution>
<id>unpack</id>
<goals>
<goal>unpack</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.my.commons</groupId>
<artifactId>my-commons-logging-resources</artifactId>
<version>5.2.2</version>
<type>jar</type>
<overWrite>true</overWrite>
<outputDirectory>${project.build.directory}/shared-resources</outputDirectory>
</artifactItem>
</artifactItems>
<includes>**/*.*</includes>
<outputDirectory>${project.build.directory}/shared-resources</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
On Wed, Oct 31, 2012 at 8:44 PM, Ron Wheeler <[email protected]
> wrote:
> Two mini-projects that share a common code base as a dependency but have a
> single file in each project log4j.xml
> Just build the one that you want.
>
> Ron
>
>
>
> On 31/10/2012 6:23 PM, Mike Summers wrote:
>
>> I'm trying to use a combination of resources and remote-resources plugin
>> to
>> manage common production configuration files and still allow for some
>> latitude during development. The effect I want is any src/main/resources
>> file that also exists in the common set is replaced by the common file
>> during rpm build.
>>
>> As a for instance, we have a standard log4j.xml file that everyone should
>> deploy to Prod with, but it's not terribly useful during Dev.
>>
>> The resources section of my pom looks like:
>>
>> <resources>
>> <resource>
>> <directory>
>> ${project.build.directory}/**maven-shared-archive-**resources/
>> </directory>
>> <filtering>true</filtering>
>> </resource>
>> <resource>
>> <directory>${basedir}/src/**main/resources/</directory>
>> <filtering>true</filtering>
>> <excludes>
>> <exclude>log4j.xml</exclude>
>> </excludes>
>> </resource>
>> </resources>
>>
>> And the remote-resources config is:
>>
>> <plugin>
>> <groupId>org.apache.maven.**plugins</groupId>
>> <artifactId>maven-remote-**resources-plugin</artifactId>
>> <version>1.4</version>
>> <configuration>
>> <resourceBundles>
>> <resourceBundle>
>> com.my.commons:my-commons-**logging-resources:${my.**
>> commons.logging.resources}
>> </resourceBundle>
>> </resourceBundles>
>> </configuration>
>> <executions>
>> <execution>
>> <phase>generate-sources</**phase>
>> <id>process-remote-resources</**id>
>> <goals>
>> <goal>process</goal>
>> </goals>
>> </execution>
>> </executions>
>> </plugin>
>>
>>
>> The common log4j.xml file is not being picked-up and the local
>> (src/main/resources) version is always showing-up even in the remote
>> plugin's resource directory.
>>
>> Should this work? Am I on the right track? Is there a better approach?
>>
>> Thanks in advance.
>>
>>
>
> --
> Ron Wheeler
> President
> Artifact Software Inc
> email: [email protected]
> skype: ronaldmwheeler
> phone: 866-970-2435, ext 102
>
>
> ------------------------------**------------------------------**---------
> To unsubscribe, e-mail:
> users-unsubscribe@maven.**apache.org<[email protected]>
> For additional commands, e-mail: [email protected]
>
>