在我的jsp中这样:
<link rel="stylesheet" href="/xxx/xxx.css">
↓
<link rel="stylesheet" href="/xxx/xxx.css?ver=20160608">
我应该使用maven还是其他工具?
答案 0 :(得分:0)
您可以使用配置了过滤器的Maven WAR插件。示例配置:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>gif</nonFilteredFileExtension>
<nonFilteredFileExtension>ico</nonFilteredFileExtension>
<nonFilteredFileExtension>jpg</nonFilteredFileExtension>
<nonFilteredFileExtension>png</nonFilteredFileExtension>
<nonFilteredFileExtension>pdf</nonFilteredFileExtension>
</nonFilteredFileExtensions>
<webResources>
<resource>
<directory>src/main/webapp</directory>
<filtering>true</filtering>
<includes>
<include>**/main.jsp</include>
</includes>
</resource>
</webResources>
</configuration>
</plugin>
在JSP中,您可以添加:
<link href="css/styles.css?version=@project.version@" rel="stylesheet"
media="screen" />