简体   繁体   English

有没有办法将带有“ jar”包装的Maven项目部署到Tomcat7中?

[英]Is there a way to deploy a Maven project with “jar” packaging into Tomcat7?

My project generates a Jar as the output package and uses an external War file, available on our Artifactory, as the Web Application to be deployed on Tomcat (currently using version 7). 我的项目生成一个Jar作为输出包,并使用Artifactory上可用的外部War文件作为要在Tomcat上部署的Web应用程序(当前使用版本7)。 This War file contains all libs and modules required for the application to run. 该War文件包含应用程序运行所需的所有库和模块。

I have already packaged and ran those projects outside eclipse on a "vanilla" Tomcat installation. 我已经打包并在Eclipse之外的“原始” Tomcat安装中运行了那些项目。 In this scenario, the Jar my project generates is loaded on the context.xml file this way: 在这种情况下,我的项目生成的Jar通过以下方式加载到context.xml文件中:

<Loader className="org.apache.catalina.loader.VirtualWebappLoader" virtualClasspath="/home/igor/workspace/myapp/myapp-2.4.3.jar"/>

Is there a way I can deploy this project on Tomcat using Eclipse and still be able to debug it? 有什么办法可以使用Eclipse在Tomcat上部署此项目,并且仍然可以对其进行调试? Can I use the Jar generated for this purpose or do I have to deploy the workspace project? 我可以为此使用生成的Jar,还是必须部署工作区项目? As for the War file, do (or can) I have to add it as an dependency? 至于War文件,我是否(或可以)将其添加为依赖项?

Thanks in advance! 提前致谢!

EDIT 编辑

We actually provide an Web Framework, which is packaged as a war. 我们实际上提供了一个打包成战争的Web框架。 Other applications that use that framework are exported as jars and loaded into the framework through the context file as cited above. 使用该框架的其他应用程序以jar形式导出,并通过上述上下文文件通过上下文文件加载到框架中。

Your question is confusing probably because of your custom plugin/classloader and deployment which is sort of orthogonal to debugging. 您的问题令人困惑,可能是由于您的自定义插件/类加载器和部署与调试正交。

What I recommend is you keep whatever system you have to build/package/deploy and use JVM remote debugging. 我建议您保留要构建/打包/部署的所有系统,并使用JVM远程调试。 That is do not use the Eclipse WTP since you seem to have custom steps for deployment but rather build your code deploy & run a separate Tomcat instance and then run the remote debugger in Eclipse . 那不是使用Eclipse WTP,因为您似乎有自定义的部署步骤,而是构建代码来部署并运行一个单独的Tomcat实例,然后在Eclipse中运行远程调试器

You will get some hotcode swapping with this method but not as much as something like JRebel.. (which you could use also) it will certainly be better than constantly redeploying. 使用这种方法,您将获得一些热代码交换,但不如JRebel ..(您也可以使用)那样多,它肯定比不断重新部署要好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM