Max
Max

Reputation: 15955

How to add multiple .properties files as build artifacts with Maven?

I have a Maven project where I want to have two build artifacts:

  1. The jar file containing the compiled Java source.
  2. A folder containing a number of .properties file.

How can I setup my Maven project to do this? And then, once I've done this, how can I consume them up the dependency graph?

Upvotes: 2

Views: 2273

Answers (1)

Gerold Broser
Gerold Broser

Reputation: 14762

Add a copy-resources goal of the Maven Resources Plugin to your POM.

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-resources-plugin</artifactId>
        <version>2.7</version>
        <executions>
          <execution>
            <id>copy-property-files</id>
            <phase>process-resources</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}/property-files</outputDirectory>
              <resources>          
                <resource>
                  ...
                </resource>
              </resources>              
            </configuration>            
          </execution>
        </executions>
      </plugin>
    </plugins>
    ...
  </build>
  ...
</project>

I can't understand what you mean exactly by "consume them up the dependency graph".

Upvotes: 4

Related Questions