Pregunta

Al copiar los recursos con el filtrado en Maven, quiero agregar la versión única de instantáneas a un archivo de recursos.

He habilitado el filtrado:

...
<name>My Application</name>
<version>0.1-SNAPSHOT</version>
...
<build>
  <resources>
    <resource>
      <directory>src/main/resources</directory>
      <filtering>true</filtering>
      ...
    </resource>
  </resources>
  ...
</build>

Este es mi archivo de recursos:

application.name=${name}
application.Version=${version}

Después de ejecutar mvn resources:resources, este es el resultado:

application.name=My Application
application.Version=0.1-SNAPSHOT

Pero lo que realmente quiero es esto:

application.name=My Application
application.Version=0.1-20120310.143733-1

¿Fue útil?

Solución

Since version 2.1.0-M1, Maven supports special syntax to get build timestamp in pom.xml, check out the doc here:

<project>
  ...
  <properties>
    <maven.build.timestamp.format>yyyyMMdd.HHmmss</maven.build.timestamp.format>
  </properties>
  ...
</project>

Alternatively, you can use buildnumber-maven-plugin.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top