krasnaya
krasnaya

Reputation: 3145

maven-assembly-plugin include *.properties at root level of zip

I'm trying to get maven to include my *.properties files when it zips up my artifacts. They are located inside src/main/resources. I tried adding the fileSet element to my assembly file, but the resources are not being included in the zip. I saw this question which seems to indicate that adding fileSet should work.

plugins.xml:

<?xml version="1.0"?>
<assembly>
    <id>release</id>
    <formats>
        <format>zip</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <fileSets>
            <fileSet>
                <directory>${project.build.directory}</directory>
                <outputDirectory>/</outputDirectory>
                <includes>
                    <include>*.properties</include>
                </includes>
            </fileSet>
    </fileSets> 
    <dependencySets>
        <dependencySet>
            <outputDirectory>/</outputDirectory>
            <useProjectArtifact>true</useProjectArtifact>
            <useTransitiveFiltering>true</useTransitiveFiltering>
        </dependencySet>
    </dependencySets>
</assembly>

Upvotes: 2

Views: 2275

Answers (1)

Tunaki
Tunaki

Reputation: 137329

The properties that you want to include inside your ZIP are located in the src/main/resources source directory of your project. So the <fileSet> element should point to this directory.

${project.build.directory} is Maven current build directory, which is by default target. You could also point to the temporary directory where Maven copies all resources during the build but it is preferable to stick with the permanent data where possible.

As such, you just need to change your <fileSet> element with:

<directory>src/main/resources</directory>

Upvotes: 1

Related Questions