我有dev/XYZ。我正在使用maven -P dev install构建一个jar文件。我如何将属性文件放在child.jar/META-INF/XYZ中?属性文件
您必须为您的配置文件dev
执行maven-resources-plugin:copy-resources
目标,并将其与适当的阶段绑定(process-resources
对我来说似乎是最好的阶段)。以下是如何定义配置文件dev
:
<profile>
<id>dev</id>
...
<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${basedir}/target/classes/META-INF</outputDirectory>
<resources>
<resource>
<directory>${basedir}/dev</directory>
<includes>
<include>XYZ.properties</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>