Eclipse在WAR中导出JAR [英] Eclipse exporting JAR in WAR

查看:129
本文介绍了Eclipse在WAR中导出JAR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在eclipse中有两个项目,一个生产一个Jar文件的图书馆项目和一个依赖该Jar的Web项目。如何让Web项目自动导出第一个项目jar在其战争中。我知道这一定已经被回答过了,但我真的找不到它。



谢谢,

解决方案

确定在战争中发生什么的机制不是正常应用程序的构建路径,而是部署程序集。



右键单击动态Web项目的根节点,然后选择属性,然后选择部署。在这里,您可以添加项目(这些项目被添加到WEB-INF / lib中)和项目中的单个jar。






编辑2015-08-20:几年后,Maven已经成为构建基于Java的软件的标准方式主要是由于基于脚本的依赖关系管理方法。这包括如何构建WAR文件,并且三个主要的IDE(IntelliJ,Netbeans和Eclipse)完全支持这一点,可以在IDE的开发过程中进行切换。在Eclipse中,这里提到的问题将不适用,因为这完全由Maven插件控制。


I have two projects in eclipse, a library project producing a Jar file and a web project dependant on that Jar. How do I get the web project to export the first projects jar in its war automatically. I know this must have been answered before, but I really cant find it.

Thanks,

解决方案

The mechanism to determine what goes in the war is not the build path as for "normal" applications, but the "Deployment assembly".

Right-click on the root node of the dynamic web project, and select Properties, and select Deployment assembly. Here you can add projects (which are jarred up and added to WEB-INF/lib) and individual jars in the project.


EDIT 2015-08-20: A few years later, Maven has become the standard way to build Java-based software primarily due to the script based approach to dependency management. This includes how to build WAR-files, and the three major IDE's (IntelliJ, Netbeans and Eclipse) fully support this allowing you to switch between IDE's while developing. In Eclipse the problem asked here will not apply, as this is fully controlled by the Maven plugin.

这篇关于Eclipse在WAR中导出JAR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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