美文网首页
Maven构建可执行jar,输出构建时间到MANIFEST.MF

Maven构建可执行jar,输出构建时间到MANIFEST.MF

作者: 花绽放水流年 | 来源:发表于2017-08-02 14:20 被阅读0次

    使用插件的方式

              <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>
    

    相关文章

      网友评论

          本文标题:Maven构建可执行jar,输出构建时间到MANIFEST.MF

          本文链接:https://www.haomeiwen.com/subject/nqoelxtx.html