我有一个带有大量JSP文件的TomCat应用程序。我最近从Gradle切换到MVN进行构建。一个很大的区别是MVN构建将所有JSP文件上的时间戳设置为构建时间。我不希望这样做有两个原因。首先,它会导致不必要的传输到未打包的JSP文件的服务,因为时间戳表明它们已经更改,而实际上它们没有更改。第二个是在测试/调试阶段,我在TomCat服务器上编辑JSP文件,我需要时间戳准确地显示文件最后一次更改的日期。
我在某个地方看到一个提示,这可能是由于MVN将行尾从Unix更改为Windows或其他什么。我也不希望它这样做。我看到<lineEnding>KEEP</lineEnding>
的设置,我已经将其放在POM文件的各个地方,但没有效果。我不知道这是否是问题。
这里是我的整个POM文件,如果这有助于
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.mycompany.app</groupId>
<artifactId>my-app</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.purplehillsbooks.purple/purple -->
<dependency>
<groupId>com.purplehillsbooks.purple</groupId>
<artifactId>purple</artifactId>
<version>3.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jsoup/jsoup -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.17.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.tomcat/tomcat-catalina -->
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
<version>11.0.0-M15</version>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpcore -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.11</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.14</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>8</source>
<target>8</target>
<lineEnding>KEEP</lineEnding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<lineEnding>keep</lineEnding>
<attachClasses>true</attachClasses>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
<webResources>
<resource>
<directory>src/main/webapp</directory>
<filtering>true</filtering>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</build>
</project>
字符串
1条答案
按热度按时间fcipmucu1#
给你两个建议。第一个是,如果你需要
maven-war-plugin
的所有配置,那么删除filtering
命令。Maven正在做你告诉它的事情-读取每个文件并查看是否有替换。它会按照指示写出新文件。但你的配置是标准的-我只需要:
字符串
它将默认为您想要的-JSP将保持它最初拥有的时间戳。