gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-28 21:49:05 27 4
gpt4 key购买 nike

我正在尝试使用 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>

在属性文件中,我有

build.date=${timestamp}

最佳答案

我的解决方案是将以下内容添加到我的 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>

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

关于eclipse - maven.build.timestamp 在部署到 tomcat 的 maven eclipse 构建中没有解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27485515/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com