热门代码使用Maven部署tomcat [英] Hot code deploy tomcat with Maven

查看:60
本文介绍了热门代码使用Maven部署tomcat的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用Maven构建的Web应用程序.它以不同项目的形式构建,它们彼此依赖-域,Dao,服务等.我在每个Eclipse中运行eclipse:eclipse来配置我的Eclipse环境.所以现在我在Eclipse中有多个项目.这是我的发展环境.

I have a web application built using maven. It is built in the form of different projects, that depend on each other - domain, dao, services etc. I ran eclipse:eclipse in each of them to configure my eclipse environment. So now I have multiple projects in eclipse. This is my development environement.

我还为运维人员构建了一个tomcat捆绑包,因此我可以为他们提供一个zip文件,他们可以提取并运行一个批处理文件来启动服务器.此zip文件包含一个战争文件,该文件在<context> Tomcat的配置中被引用.

I also built a tomcat bundle for the Operations guys so I can just provide them with a zip file which they can extract and run a batch file to start the server up. This zip file contains a war file which is referred to in the <context> configuration for tomcat.

此外,出于开发目的,我将tomcat设置为从eclipse中启动.我的目的是每当源代码更改时就进行热代码部署.当前不会发生这种情况,因为类文件位于目标"文件夹中(由于maven的目录结构).然后tomcat查看war文件(我的意思是爆炸的结构.)

Also, for development purposes, I have set tomcat to start up from within eclipse. My aim is to do hot code deploy whenever the source changes. This doesnt happen currently because the class files live in the "target" folder(due to maven's directory structure). And tomcat looks at the war file(exploded structure i mean..)

如何配置tomcat/eclipse环境,以便可以开始进行热代码部署?

How can i configure my tomcat/eclipse enviroment so I can start doing hot code deploy?

-谢谢!

推荐答案

我使用 tomcat-maven -plugin 及其目标tomcat7:run从eclipse内启动tomcat(顺便说一句,使用m2e eclipse插件-很好的工具-在eclipse市场有售).热代码替换对我也不起作用.但是我使用了一种解决方法:使用<contextReloadable>true</contextReloadable>,tomcat在检测到文件更改时会重新加载应用程序.

I use the tomcat-maven-plugin and its goal tomcat7:run to start tomcat from within eclipse (btw using m2e plugin for eclipse - great tool - available from eclipse market place). Hot code replacement doesn't work for me, too. But I use a workaround: with <contextReloadable>true</contextReloadable> tomcat reloads the application whenever it detects a file change.

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <path>/myapp</path>
                <contextReloadable>true</contextReloadable>
            </configuration>
        </plugin>
    </plugins>
</build>

这篇关于热门代码使用Maven部署tomcat的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆