Maven assembly plugin: excluding files while using a standard descriptorRef
I'm developing a simple, stand-alone, command line Java application. The project is managed by Maven. I'd like to build a deliverable, which can be copied and run on the client's machine.
The maven-assembly plugin with the default 'jar-with-dependencies' type is ok for me, but I don't want to package the log4j.properties file into the jar. I'd rather have it in a separate "res" folder.
I've managed to put a Class-Path header in the manifest file for the res folder, but I'm having trouble excluding the log4j.properties file from the generated jar.
What I'm trying is to have the file excluded without writing a custom assembly descriptor. I'd like to customize the default solution, like this:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<excludes>
<exclude>**/log4j.properties</exclude>
</excludes>
<archive>
<manifest>
开发者_高级运维 <mainClass>com.my.App</mainClass>
</manifest>
<manifestEntries>
<Class-Path>res/</Class-Path>
</manifestEntries>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration></plugin>
but it doesn't work. Do I have to write a custom assembly descriptor for this?
From the doc, it looks like you cannot exclude files by customizing <plugin>
parameters alone.
<excludes>
does not look like a valid parameter for the plugin and is thus getting ignored.
精彩评论