maven.build.timestamp没有在部署到tomcat的maven eclipse构建中解析

css*_*css 4 eclipse tomcat maven tomcat8

我正在尝试使用Eclipse Luna调试我的Maven webapp项目以在Tomcat 8中启动它.不幸的是,在尝试将其部署到Tomcat时,资源过滤期间的构建时间戳没有得到解决.Eclipse构建的WAR文件已解决,但它部署到Tomcat(通过"在服务器上运行"选项)不会.

在我的pom.xml中,我得到了:

<properties>
  <timestamp>${maven.build.timestamp}</timestamp>
</properties>

<build>
  <finalName>rapid-installer</finalName>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-war-plugin</artifactId>
      <version>2.4</version>
      <configuration>
        <failOnMissingWebXml>false</failOnMissingWebXml>
      </configuration>
    </plugin>
  </plugins>
  <resources>
    <resource>
      <directory>src/main/resources</directory>
      <filtering>true</filtering>
    </resource>
  </resources>
</build>
Run Code Online (Sandbox Code Playgroud)

在一个属性文件中,我有

build.date=${timestamp}
Run Code Online (Sandbox Code Playgroud)

css*_*css 5

我的解决方案是将以下内容添加到我的pom.xml中,以便时间戳可用,使得应用程序在Tomcat启动时不会崩溃.

<profiles>
  <profile>
  <id>m2e</id>
    <activation>
      <property>
        <name>m2e.version</name>
      </property>
    </activation>
    <properties>
      <maven.build.timestamp>2014-01-01</maven.build.timestamp>
    </properties>
  </profile>
</profiles>
Run Code Online (Sandbox Code Playgroud)

现在,当应用程序通过Eclipse中的"Run on Server"部署到Tomcat时,它始终显示构建时间戳.有关为什么需要这样做以及如何工作的详细信息:https://bugs.eclipse.org/bugs/show_bug.cgi?id = 3888874