Linux Maven日期格式不正确
我已经打开了对pom.xml文件的web资源过滤。我正在使用maven在jsp中更新构建日期 为此,我在pom.xml中编写了以下几行代码Linux Maven日期格式不正确,linux,windows,maven,date,jenkins,Linux,Windows,Maven,Date,Jenkins,我已经打开了对pom.xml文件的web资源过滤。我正在使用maven在jsp中更新构建日期 为此,我在pom.xml中编写了以下几行代码 <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.build.timestamp.format>MMM dd, yyyy</maven.build.t
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.build.timestamp.format>MMM dd, yyyy</maven.build.timestamp.format>
<build-date>${maven.build.timestamp}</build-date>
</properties>
UTF-8
年月日
${maven.build.timestamp}
maven-war插件
2.3
默认战争
包裹
战争
src/main/webapp
真的
在我的jsp中,我将日期写为-
<span class="note">Last updated on ${build-date}</span>
上次更新日期为${build date}
当我在我的windows系统上构建它时,它可以完美地工作,并以正确的格式替换日期(MMM dd,yyyy),但是当我在linux系统上使用jenkins构建此项目时,日期的格式不正确(不是MMM dd,yyyy)。它以其他格式显示,例如显示20131022-1416
我找不到这个问题。这是因为linux系统、jenkins还是不同的maven版本 我也有同样的问题,似乎有一个maven的问题。为了绕过这个问题,我使用它来填充${timestamp}maven变量,然后在
release.properties
文件中引用该变量:
pom配置:
<span class="note">Last updated on ${build-date}</span>
<plugin>
<!-- workaround for ${maven.build.timestamp} not being available when filtering resources -->
<groupId>com.keyboardsamurais.maven</groupId>
<artifactId>maven-timestamp-plugin</artifactId>
<version>1.0</version>
<configuration>
<propertyName>timestamp</propertyName>
<timestampPattern>dd/MM/yyyy HH:mm:ss z</timestampPattern>
</configuration>
<executions>
<execution>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
</plugin>
# date when the current release was built
build.date=${timestamp}