我们知道开发过程中,我不可能每次都去打个war包,然后部署到tomcat的webapp目录下,太麻烦了。

在网上搜不不少文章,有这么一种方案,简单说下思路,在pom中增加

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>tomcat-maven-plugin</artifactId>
    <version>1.1</version>
    <configuration>
        <url>http://localhost:8080/manager/html</url>
        <server>tomcat</server>
        <path>/lowca</path>   
    </configuration>
</plugin>

启动tomcat,然后运行maven命令:mvn:tomcat:redeploy
个人觉得这种方法不太好,有两个缺点:1、必须先启动tomcat,2、debug貌似不方便(猜的)
 

接下来自己 摸索了一下

部署ssm-web到tomcat

使用工具部署

部署完后,运行报错。这时发现ssm-web工程下的配置文件全丢了

猜想是不是没有output。右击ssm-web工程,打开properties

好像找到原因了,再次部署一下ssm-web到tomcat,发现问题居然没有解决,此时再次右击ssm-web工程,打开properties,我看到了什么?我刚刚勾选的Allow output folders for source folders选项居然又恢复成未选了,这是什么情况?重复试验几次,依然是这个情况,不知道是不是故意这样的设计,郁闷了。

此时我对比,未用maven管理的web项目,如下图,

此配置文件已拷贝至我希望的路径下。

再次对比两个工程的properties。好吧,果然不一样,有区别

excluded顾名思义,不包括。做下修改,鼠标放上去,点右边的Edit(或是直接Remove掉)

最后再部署到tomcat,检查一下,OK问题解决

不知这样修改,会不会影响打出的war包。。验证一下执行maven install,也没有问题

 

最后比较一下,直接部署到tomcat和打war包的区别

我只看结果,至于两者的优缺点不多说,一个是开发方便,一个是归档方便。

ssm-web依赖jar项目ssm-atomic,在把ssm-web打war包时,ssm-atomic被打成jar包,放在lib目录下。

tomcat部署时,ssm-atomic下的java被编译成class,放在了apache-tomcat-6.0.37\webapps\ssm-web\WEB-INF\classes\com\tch

 

参考:http://blog.csdn.net/qq964166471/article/details/19981441

 

GitHub 加速计划 / ma / maven
36
0
下载
Maven: Apache Maven是一个开源的项目管理和构建工具,主要用于Java项目。适合需要自动化项目构建和依赖管理的开发者。特点包括约定优于配置、易于使用和社区驱动。
最近提交(Master分支:15 天前 )
7872c6d8 Changes: * update Mimir to latest 0.8.1 version * update infusers as well * cache changes (see below) Cache strategy changes: * initial build: it is snowballing one cache when build is not about PR * full (rebuild itself + site with itself) and its build: it is snowballing cache differentiated by OS/JDK when build is not about PR Current problems: on unchanged POM (ie. new IT added), the dependencies ITs pull from Central will be cached by Mimir, but due "cache hit" the new cache will not get stored. Hence, Mimir caching was basically lost. Also, there was a mixup of caches from PRs and main branches. Finally, matrix jobs were competing for cache store. 19 小时前
c999cff6 Accept ONLY documented forms of them. Fixes #10210 1 天前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐