Maven Plugins
来源:互联网 发布:ubuntu麒麟 下载 编辑:程序博客网 时间:2024/06/05 02:47
maven-compiler-plugin
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.3</version> <configuration> <!--设置该参数后,使用这个jar的工程的JDK则必须是1.8+,否则编译不通过--> <!--该参数主要用于设定使用该jar包的jdk版本,比如有些jar只能在jdk8上运行编译,使用了jdk8的某些新的特性--> <source>1.8</source> <target>1.8</target> </configuration></plugin>
maven-war-plugin
通过warSourceExcludes和packagingExcludes参数可以在打包是忽略掉指定的文件。
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1.1</version> <configuration> <!--xxx目录位于webapp目录下--> <warSourceExcludes>xxx\**</warSourceExcludes> </configuration></plugin>
overlay
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.6</version> <configuration> <warName>cas-server</warName> <overlays> <overlay> <groupId>org.jasig.cas</groupId> <artifactId>cas-server-webapp</artifactId> <!--排除cas-server-webapp中的文件,使用自己的配置文件--> <excludes> <exclude>WEB-INF/cas.properties</exclude> <exclude>WEB-INF/classes/log4j.xml</exclude> <exclude>WEB-INF/web.xml</exclude> </excludes> </overlay> </overlays> </configuration></plugin>
jetty-maven-plugin
<plugin> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>9.0.0.v20130308</version> <configuration> <httpConnector> <port>10011</port> </httpConnector> <webApp> <contextPath>/</contextPath> <!--该参数在使用overlay时添加,解决Duplicate fragment name ERROR问题--> <!--通常情况下不需要该配置--> <allowDuplicateFragmentNames>true</allowDuplicateFragmentNames> </webApp> <stopKey>stop</stopKey> <stopPort>10012</stopPort> </configuration></plugin>
热部署配置
<plugin> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>9.0.0.v20130308</version> <configuration> <!--热部署不需要该参数,该参数用于修改配置文件后自动重启(不清楚这参数的意义,反正热部署用不到)--> <!--<scanIntervalSeconds>10</scanIntervalSeconds>--> <httpConnector> <port>8080</port> </httpConnector> <webApp> <contextPath>/</contextPath> <!--配置该参数,修改webdefault.xml,才能修改静态文件--> <defaultsDescriptor>src/test/resources/webdefault.xml</defaultsDescriptor> </webApp> <stopKey>stop</stopKey> <stopPort>8889</stopPort> </configuration></plugin>
webdefault.xml 存在于jar包中,复制到src/test/resources下,并修改属性useFileMappedBuffer:
\org\eclipse\jetty\jetty-webapp\9.0.0.v20130308\jetty-webapp-9.0.0.v20130308.jar\org\eclipse\jetty\webapp\webdefault.xml
把useFileMappedBuffer的值从true改为false即可:
<init-param> <param-name>useFileMappedBuffer</param-name> <param-value>false</param-value></init-param>
热部署方法:
- 开发工具IDEA
- 使用Debug模式启动jetty, 修改java文件后,手动编译该文件即可,IDEA会显示jetty: reloaded class
手动编译的方式:
- Ctrl+F9 :Make Project, 编译整个工程,用于一次修改多个java文件的情况
- Ctrl+Shift+F9 :编译单个文件
注意这里使用的是jetty plugin启动的项目,如果使用外部的jetty server,或者tomcat server,应该有自动编译的选项,不需要手动编译。当然手动编译也是可以热部署的。
还有一点,这种方式不支持修改方法名或者新增方法的热部署。
jetty命令:
## jetty.reload默认值也是automatic,通常我们只需要jetty:run,在特殊常见下,也是可以以下面的方式启动jettyjetty:run -Djetty.reload=automatic -Djetty.scanIntervalSeconds=10
maven-assembly-plugin
The Assembly Plugin for Maven is primarily intended to allow users to aggregate the project output along with its dependencies, modules, site documentation, and other files into a single distributable archive.
To use the Assembly Plugin in Maven, you simply need to:
choose or write the assembly descriptor to use,configure the Assembly Plugin in your project's pom.xml, andrun "mvn assembly:single" on your project.
链接
- duplicate-fragment-name-error-jetty-maven-plugin
- 关于maven-jetty-plugin 自动重启问题
- maven plugins
- Maven - Plugins
- Maven Plugins
- Using Maven Plugins --org.apache.maven.plugins
- maven plugins 教程
- maven plugins 常用
- maven几个plugins
- maven-plugins---maven-assembly-plugin
- eclipse 3.6.1 maven plugins
- Difference of Maven JAXB plugins
- Maven中plugins和pluginManagement
- 【MAVEN】项目管理插件maven-plugins
- org.apache.maven.plugins:maven-war-plugin
- Project ID: org.apache.maven.plugins:maven-assembly-plugin Reason: POM 'org.apache.maven.plugins:ma
- Maven错误:'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing
- appFuse2.x第七篇--Maven Plugins
- maven的pom文件报plugins找不到
- Failure to transfer org.apache.maven.plugins
- Eclipse安装SVN插件(本地安装)
- XML的解析
- 【Unity3D】本地数据加密_1
- osi七层模型,TCP/IP四层模型
- HDU 1506 Largest Rectangle in a Histogram(dp求最大子矩阵和)
- Maven Plugins
- POJ 1273&Dinic解决
- HDU1032:The 3n + 1 problem(比较运算次数)
- 遥感常用数据下载链接
- 华为2017年大牛机试题—最长回文字符串
- POJ 1703 并查集
- eclipse build path功能总结
- mysql遇到的问题总结
- 51nod 1119