如何在maven中写入文件并更改目标目标目标文件夹?
我想将变量如何在maven中写入文件并更改目标目标目标文件夹?,maven,Maven,我想将变量${mercurialVersion}(最新的mercurial标记)写入maven中的文件,并将目标目录更改为target/prod latestMercurialTag/app.war。我该怎么做 这是我用来用最新的hg标记填充${mercurialVersion}的代码: <plugin> <groupId>org.codehaus.gmaven</groupId> <artifactId>gmaven-plugin
${mercurialVersion}
(最新的mercurial标记)写入maven中的文件,并将目标目录更改为target/prod latestMercurialTag/app.war。我该怎么做
这是我用来用最新的hg标记填充${mercurialVersion}
的代码:
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>execute</goal>
</goals>
</execution>
</executions>
<configuration>
<properties>
<script>hg parent --template {latesttag}</script>
</properties>
<source>
def command = project.properties.script
def process =
command.execute()
process.waitFor()
project.properties.mercurialVersion = process.in.text
</source>
</configuration>
</plugin>
org.codehaus.gmaven
gmaven插件
1.4
初始化
执行
hg parent--模板{latesttag}
def命令=project.properties.script
def过程=
command.execute()
process.waitFor()
project.properties.mercurialVersion=process.in.text
我试过:
<plugin>
<groupId>com.internetitem</groupId>
<artifactId>write-properties-file-maven-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution>
<id>mercurialVersion</id>
<phase>compile</phase>
<goals>
<goal>write-properties-file</goal>
</goals>
<configuration>
<outputFile>${baseDir}/src/main/resources</outputFile>
<filename>version.properties</filename>
<properties>
<property>
<name>version</name>
<value>${mercurialVersion}</value>
</property>
<property>
<name>artifactId</name>
<value>My Artifact ID is ${project.artifactId}</value>
</property>
</properties>
</configuration>
</execution>
</executions>
</plugin>
com.internetitem
写属性文件maven插件
1.0.1
汞中毒
编译
写入属性文件
${baseDir}/src/main/resources
version.properties
版本
${mercurialVersion}
人工的
我的工件ID是${project.artifactId}
但是没有任何内容进入${baseDir}/src/main/resources/version.properties
文件
先谢谢你
致以最诚挚的问候,misms您检查过这个吗:我检查过。对于如何进行构建版本控制,您有什么建议吗?是否有一本针对标准情况的简单食谱?我做错了什么?