Dou*_*kem 122 java maven-2 build properties-file
有谁知道如何在Maven中读取x.properties文件.我知道有一些方法可以使用资源过滤来读取属性文件并从中设置值,但是我想在我的pom.xml中使用以下方法:
<properties file="x.properties">
</properties>
Run Code Online (Sandbox Code Playgroud)
有一些讨论: Maven外部属性
Mik*_*one 92
Dou*_*kem 54
使用建议的Maven属性插件,我能够读取buildNumber.properties文件,该文件用于对我的构建进行版本控制.
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-1</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${basedir}/../project-parent/buildNumber.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
171984 次 |
| 最近记录: |