Maven System + Date

I am working on a project that already has a build process with maven .

Today the build creates a zip file in a given directory, but I need to add a DATE template to the file, something like200917_projectName.zip

Does anyone have a key?

Thank you in advance

+2


source to share


3 answers


Using the build-number-maven-plugin allows you to generate a property that can then be used on the property finalName

.

The following configuration sets a timestamp property with the required format and then changes finalName to use this property and results in an artifact with that name, which is printed to the target directory.



Note that this name is ignored when installing / deploying the artifact, otherwise Maven will not be able to reliably find the artifacts.

<build>
  <finalName>${buildNumber}_${project.artifactId}</finalName>
  <plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>buildnumber-maven-plugin</artifactId>
      <version>1.0-beta-3</version>
      <executions>
        <execution>
          <phase>validate</phase>
          <goals>
            <goal>create</goal>
          </goals>
        </execution>
      </executions>
      <configuration>
        <format>{0,date,yyyyMM}</format>
        <items>
          <item>timestamp</item>
        </items>
      </configuration>
    </plugin>
  ...
  </plugins>
...
</build>

      

+4


source


maybe this link will help you:



http://commons.ucalgary.ca/projects/maven-buildnumber-plugin/howto.html

+2


source


Build Maven Plugin is what you are looking for. Check usage page .

0


source







All Articles