使用插件的方式
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>timestamp-property</id>
<goals>
<goal>timestamp-property</goal>
</goals>
</execution>
</executions>
<configuration>
<name>current.time</name>
<pattern>yyyyMMddHHmmss</pattern>
<timeZone>GMT+8</timeZone>
</configuration>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<archive>
<addMavenDescriptor>false</addMavenDescriptor>
<manifestEntries>
<Main-Version>${current.time}</Main-Version>
</manifestEntries>
<manifest>
<mainClass>platform.MainApplication</mainClass>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
<excludes>
<exclude>test</exclude>
</excludes>
<classesDirectory>target/classes/</classesDirectory>
</configuration>
</plugin>
网友评论