7

During my build I generate a build.properties files via the maven properties plugin (properties-maven-plugin) containing build information.

What's the best way to have this file included in the generated jar? I don't want to put it into the src/main/resources directory as this would pollute my default resource directory.

Is there not a "generated-resources" directory as there is with source?

5 Answers 5

22

I thought there was a default generated-resources directory, but I can't find any documentation on that at the moment. You can always configure additional resource directories in your pom:

<build>
    <resources>
        <resource>
            <directory>${basedir}/src/main/resources</directory>
        </resource>
        <resource>
            <directory>${project.build.directory}/generated-resources</directory>
        </resource>
    </resources>
    ...
</build>
1

Place generated sources in target/generated-sources

There is a plugin called build-helper that allows you to add that folder to the source-folders list.

0

You can use maven assembly plugin to organize files and filesets in packages. have a look at http://maven.apache.org/plugins/maven-assembly-plugin/advanced-descriptor-topics.html I think it is what you need.

0

you can output your files to any directory and add that resource directory to your <resources> of your <build>

-4

You should put it in the target/classes directory

(fixed now from just target) and I think that this is better than the accepted one. As there is no need to process this resource as resource anymore

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.