java – 在构建WAR之前,在Maven中重命名生成的文件
越过你的手指可以帮助我!
我使用SmartSprites将我的目标网页上的PNG合并为一个,以便加载更快. SmartSprite将检查您的CSS文件,生成CSS Sprite图像,并创建一个新的CSS文件,该文件将使用此精灵图像而不是原始图像.我想要做的是在我的maven WAR构建期间自动用SmartSprite替换原始的CSS文件. 所以这就是我想要发生的事情: > SmartSprite扫描我的CSS文件:mystyle.css 这两个文件都位于输出目录(target / myproj / css)中. SmartSprite中似乎没有任何标志可以覆盖原始文件,所以我想它必须在后期处理中完成. 下面是我用于SmartSprite的maven插件配置. <plugin> <groupId>org.carrot2.labs</groupId> <artifactId>smartsprites-maven-plugin</artifactId> <version>1.0</version> <executions> <execution> <phase>prepare-package</phase> <goals> <goal>spritify</goal> </goals> </execution> </executions> </plugin> 解决方法
你可以使用
Maven WAR plugin:
<plugin> <artifactId>maven-war-plugin</artifactId> <configuration> <webResources> <resource> <directory><!-- Your output directory --></directory> <targetPath><!-- The target location of the files below --></targetPath> <includes> <include><!-- file pattern --></include> <include><!-- file pattern --></include> </includes> </resource> </webResources> </configuration> </plugin> 您还应该配置SmartSprites以使用不同的输出目录来保留原始CSS文件名.尝试使用空的css-file-suffix值的output-dir-path选项. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |