我需要Eclipse来部署WAR文件我的Ant脚本构建的,而不是它在内部建立 [英] I need Eclipse to deploy the WAR file my ANT script builds, not what it builds internally

查看:229
本文介绍了我需要Eclipse来部署WAR文件我的Ant脚本构建的,而不是它在内部建立的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Eclipse赫利俄斯。我有一个动态Web项目去,我已经设置了Eclipse中使用Ant生成器生成一个WAR文件。这一切工作正常;如果我改变一个.java文件,Eclipse将自动通过Ant运行的build.xml我并更新我的抗战。如果我部署WAR到Tomcat的外部例如,它完美的作品。

I'm using Eclipse Helios. I have a dynamic web project going and I've set up Eclipse to use an Ant Builder to generate a WAR file. This all works fine; if I change a .java file, Eclipse automatically runs my build.xml via Ant and updates my WAR. If I deploy the WAR to an external instance of Tomcat, it works perfectly.

然而,当我告诉Eclipse运行我在Tomcat下的项目,它不使用由Ant构建生成的WAR文件,或者使用我的Ant脚本生成一个临时WAR。

However, when I tell Eclipse to run my project under Tomcat, it is not using the WAR file generated by the Ant build, or using my Ant script to generate a temporary WAR.

我知道这是因为我的build.xml脚本包括未在WEB-INF /类目录了Eclipse推出结束了战争WEB-INF / classes中一些额外的XML配置文件。

I know this because my build.xml script includes some additional XML configuration files in WEB-INF/classes in the WAR that are not ending up in the WEB-INF/classes dir that Eclipse pushes out.

我似乎无法找到在Eclipse东西,说:当你发布,使用,而不是建立自己的这个WAR文件。

I can't seem to find anything within Eclipse that says "when you publish, use this WAR file instead of building your own".

另一种方法是,告诉Tomcat的,当它正在建设一个WAR通过添加文件列表这样做,但我似乎无法找到一个方法来做到,要么。

An alternate approach would be to tell Tomcat when it is building a WAR to do so by adding a list of files, but I can't seem to find a way to do that either.

我也好奇,Eclipse是如何知道要发布什么,因为它显然是无视我的build.xml和pviously生成的WAR文件我的$ P $。

I'm also curious how Eclipse knows what to publish since it is obviously ignoring my build.xml and my previously-generated WAR file.

推荐答案

Eclipse的部署通过查看项目的Web部署大会选项的Web应用程序。您可以通过右键单击项目,选择Properties看到这一点,然后点击部署大会。月食通常这里使用了一个展开的目录部署,而不是创建和部署WAR(这是基于所使用的服务器插件,但我认为他们大多使用高速扩展的目录结构)。如果导出为WAR它会创建一个具有相同内容的WAR。

Eclipse deploys a web application by looking at the Web Deployment Assembly options for your project. You can see this by right-clicking the project, choosing Properties, and then click on Deployment Assembly. Eclipse usually uses an expanded directory deployment here rather than creating and deploying a WAR (this is based on the server plugin being used, but I think most of them use an expanded directory structure for speed). If you export as a WAR it will create a WAR with the same content.

有两个主要选择,做你想要什么:

There are two main choices to do what you'd like:


  • 修改Web部署大会选项,以满足正是你想在部署应用程序

  • Modify the Web Deployment Assembly options to match exactly what you would like in the deployed app

不要使用Eclipse的部署;添加一个外部Ant构建器的建设者选项为你的项目(右键单击项目,选择属性 - >建设者)。然后,您可以选择您希望在Eclipse构建项目中使用ant的文件,该文件的目标。这些选项之一可以是部署步

Don't use Eclipse's deployment; add an "External Ant Builder" to the "Builders" options for your project (right-click project, choose Properties->Builders). You can then select which targets in the ant file you want to use when eclipse builds the project. One of these options can be a deployment step

这篇关于我需要Eclipse来部署WAR文件我的Ant脚本构建的,而不是它在内部建立的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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