maven管理ssh项目
使用Maven管理项目
1. 静态资源的合并和压缩
pom.xml中继续配置:
<plugin> <!-- YUI Compressor Maven压缩插件 执行命令 mvn yuicompressor:compress --> <groupId>net.alchim31.maven</groupId> <artifactId>yuicompressor-maven-plugin</artifactId> <version>1.3.0</version> <inherited>true</inherited> <configuration> <!-- 读取js,css文件采用UTF-8编码 --> <encoding>UTF-8</encoding> <!-- 不显示js可能的错误 --> <jswarn>false</jswarn> <!-- 若存在已压缩的文件,会先对比源文件是否有改动 有改动便压缩,无改动就不压缩 --> <force>true</force> <!-- 在指定的列号后插入新行 --> <linebreakpos>-1</linebreakpos> <!-- 压缩之前先执行聚合文件操作 --> <preProcessAggregates>true</preProcessAggregates> <!-- 压缩后保存文件后缀 --> <suffix>.min</suffix> <!-- 源目录,即需压缩的根目录 --> <sourceDirectory>${project.build.directory}/classes/static/</sourceDirectory> <!-- 压缩js和css文件 --> <includes> <include>market/css/market.css</include> <include>market/js/**/*.js</include> </includes> <!-- 以下目录和文件不会被压缩 --> <excludes> <exclude>**/*.min.js</exclude> <exclude>**/*.min.css</exclude> </excludes> <!-- 压缩后输出文件目录 --> <outputDirectory>${project.build.directory}/classes/static</outputDirectory> </configuration> <executions> <!--加入生命周期--> <execution> <id>yuicompressor</id> <phase>prepare-package</phase> <goals> <goal>compress</goal> </goals> </execution> </executions> </plugin>
2. maven管理项目,打jar包的配置处理:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <version>2.3.1</version> <configuration> <warSourceDirectory>target/pure</warSourceDirectory> <packagingExcludes> WEB-INF/classes/static/**/*.css, </packagingExcludes> </configuration> <executions> <execution> <id>pure-jar</id> <phase>package</phase> <goals> <goal>jar</goal> </goals> </execution> </executions> </plugin>
相关推荐
会哭的雨 2020-01-16
mmyCSDN 2019-12-13
超哥Blog 2012-03-17
itisyang 2011-05-23
明鱼 2010-08-23
ConquerALL 2010-06-07
kongguguren 2010-05-03
wanzi 2010-03-20
hongsheyoumo 2010-01-18
lichuanlong00 2010-01-07
colin00 2012-04-02
MrRaoJL 2011-06-17
迷题 2010-12-10
付海军 2009-02-12