resin4运行Maven项目,这个是目前试用的最顺手的一个配置方式。只有更改pom.xml才需要重新package.
<cluster id="app">
<!-- define the servers in the cluster -->
<server-multi address-list="${app_servers}" id-prefix="app-" port="6800"/>
<host-default>
<!-- creates the webapps directory for .war expansion -->
<dependency-check-interval>2s</dependency-check-interval>
<web-app-deploy expand-preserve-fileset="WEB-INF/work/**" multiversion-routing="${webapp_multiversion_routing}" path="webapps" path-suffix="${elastic_webapp?resin.id:''}" startup-mode="lazy"/>
</host-default>
<!-- auto virtual host deployment in hosts/foo.example.com/webapps -->
<host-deploy path="hosts">
<host-default>
<resin:import optional="true" path="host.xml"/>
</host-default>
</host-deploy>
<!-- the default host, matching any host name -->
<host id="" root-directory="${app.home}">
<web-app id="/" root-directory="${app.home}\src\main\webapp">
<!-- configurate web directory -->
<prologue>
<class-loader>
<compiling-loader path="${app.home}\target\classes" />
<!-- configurate class directory -->
<library-loader path="${app.home}\target\${app.name}\WEB-INF\lib" />
<!-- configurate library directory -->
</class-loader>
</prologue>
</web-app>
</host>
<resin:if test="${resin_doc}">
<host id="${resin_doc_host}" root-directory="${resin_doc_host}">
<web-app id="/resin-doc" root-directory="${resin.root}/doc/resin-doc"/>
</host>
</resin:if>
</cluster>
app.home为maven项目根目录
app.name为maven项目构建后的名字
源文档 <http://www.kankanews.com/ICkengine/archives/35523.shtml>
优点:基本上达到了只用Maven构建一次(pom文件不修改的情况下)就可以自动加载修改过的jsp和资源文件(js、css等)
缺点:不能像tomcat那样,可以用Maven命令一次性完成构建,启动等工作。也就是说,Resin启动必须手动执行