Maven-web项目
来源:互联网 发布:mac os x install esd 编辑:程序博客网 时间:2024/06/05 15:33
1.需要显示指定打包为war
< packaging>war</packaging>
2. maven 自带的属性
${project.groupId} ${project.version]
3. 使用jetty-maven-plugin对web项目进行测试
配置jetty 插件:
<plugin><groupId>org.mortbay.jetty</groupId><artifactId>jetty-maven-plugin</artifactId><version>7.1.0.RC1</version><configuration><scanIntervalSeconds>10</scanIntervalSeconds> //指名扫描间隔时间<webAppConfig><contextPath>/account</contextPath> //访问的路径</webAppConfig></configuration></plugin修改settings.xml
<pluginGroups><pluginGroup>org.moetbat.jetty</pluginGroup></pluginGroups>
然后在命令行运行:
mvn jetty:run
mvn jetty:run -Djetty.port=9999
使用Cargo实现自动化部署
cargo-maven2-plugin提供了Maven集成,
步骤:standalone 模式(复制保存) existing模式(指定配置目录)
- <plugin>
- <groupId>org.codehaus.cargo</groupId>
- <artifactId>cargo-maven2-plugin</artifactId>
- <version>1.1.3</version>
- <configuration>
- <container>
- <containerId>tomcat7x</containerId>
- <home>E:\tomcat\apache-tomcat-7.0.26</home>
- </container>
- <configuration>
- <type>existing</type>
- <home>E:\tomcat\apache-tomcat-7.0.26</home>
- <properties>
- <cargo.servlet.port>8090</cargo.servlet.port>
- </properties>
- <!--
- <type>standalone</type>
- <home>${project.build.directory}/tomcat7x</home>
- -->
- </configuration>
- </configuration>
- </plugin>
在settings.xml中配置,可以使用命令 mvn cargo:start
当使用standalone 时,上述命令不起作用时,使用mvn cargo:run
注意:cargo:start需要额外配置一个<wait>的参数,否则的话虽然cargo:start可以把容器启动,但是在maven生命周期跑完之后,容器也就立刻关闭了
这个需要自动启动tomcat 否则不能访问。
远程配置:
- <plugin>
- <groupId>org.codehaus.cargo</groupId>
- <artifactId>cargo-maven2-plugin</artifactId>
- <version>1.1.3</version>
- <configuration>
- <container>
- <containerId>tomcat7x</containerId>
- <type>remote</type>
- </container>
- <configuration>
- <type>runtime</type>
- <properties>
- <cargo.remote.username>tomcat</cargo.remote.username>
- <cargo.remote.password>tomcat</cargo.remote.password>
- <cargo.remote.manager.url>http://localhost:8080/manager</cargo.remote.manager.url>
- </properties>
- </configuration>
- </configuration>
- </plugin>
使用命令:mvn cargo:redeploy
注意使用jps查看java进程
0 0
- [maven]构建maven web项目
- maven创建web项目
- Maven构建Web项目
- maven创建web项目
- maven创建web项目
- Maven Web 项目
- Maven 创建web项目
- eclipse maven web项目
- maven整合web项目
- Maven 创建web项目
- MAVEN WEB项目 单元测试
- Maven-web项目
- maven开发web项目
- maven创建web项目
- Maven 创建web项目
- Maven创建web项目
- maven创建web项目
- Maven创建web项目
- suse下配置IP、DNS、网关
- 关于Ubuntu的ip设置
- JS调用中文乱码
- jquery 常用方法
- C#多线程学习(二) 如何操纵一个线程
- Maven-web项目
- 本地浏览器输入地址,最终如何调用成功
- IOS键盘出现时视图上移
- 将Openfire中的MUC改造成类似QQ群一样的永久群
- ubuntu中vi上下左右键显示字母的解决方法
- 开源Bug管理系统Redmine安装和使用心得
- 百亿富翁宗庆后的创业人生
- 做了几天的登录界面
- 设计模式之命令模式