可以直接从 eclipse 发布 .war 到 Web 服务器吗

发布于 2024-08-23 23:31:44 字数 90 浏览 3 评论 0原文

您可以直接从 eclipse 向 Web 服务器发布 .war 吗?

我知道这不是一个编程问题,但我仍然认为这是一个相关的问题。

谢谢

Can you publish a .war directly from eclipse to a web server.

I know it's not a programming question, but I still think it's a relevant question.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

生寂 2024-08-30 23:31:44

是的,你可以。

右键单击项目,选择导出->选择网页->然后战争并给出目的地,即您的部署文件夹。

yes you can.

right click on the project, select export -> select web - > then war and give destination which is your deploy folder.

遗心遗梦遗幸福 2024-08-30 23:31:44

是的,但这在很大程度上取决于您的项目配置。一般需要在eclipse中定义服务器,并选择“Run on Server”。

参见这个作为从 eclipse 部署到 JBoss 服务器上的示例。

如果您使用 Ant,那么使用“deploy”目标就可以了。

Yes, but it depends a lot on your project configuration. Generally you need to define the server in eclipse, and choose "Run on Server".

See this as an example of deploying on JBoss server from eclipse.

In case you are using Ant then using "deploy" target will work.

救星 2024-08-30 23:31:44

这应该很简单:

  1. 将 war 文件导入到 eclipse 中。文件>导入...>>网页>战争文件。
    (可能只适用于 eclipse 进行 java ee 开发)

  2. 选择 war 文件,创建一个新项目(任何新名称都有效),单击完成

  3. 将新项目添加到您的服务器

  4. Blam!

This should be pretty easy:

  1. Import the war file into eclipse. File > Import... > Web > WAR File.
    (likely only works on eclipse for java ee development)

  2. Pick the war file, create a new project (any new name works), click finish

  3. Add the new project to your server

  4. Blam!

奈何桥上唱咆哮 2024-08-30 23:31:44

如果您的项目在 Eclipse 中设置为 Web 项目,您可以选择在服务器上运行它(您必须首先配置服务器)。这将从 Eclipse 直接将 war 文件发布到服务器上。

If your project is setup as a web project in Eclipse, you can choose to run it on a server (You'll have to configure the server first). This will publish the war file directly on the server from Eclipse.

意中人 2024-08-30 23:31:44

如果 Web 服务器具有自动部署功能和神奇目录,则这是最简单的。然后只需文件->将 WAR 文件导出到自动部署文件夹中。

如果没有,或者如果您希望能够在 Eclipse 内调试 WAR 文件,则需要在 WTP 模块中拥有适当的服务器连接器(默认情况下包含在 Eclipse 的 Java EE 版本中)。

如果您想以编程方式直接从 Eclipse 中将 WAR 文件推送到给定服务器,那么您可以使用 Tomcat Ant 任务 - http://tomcat.apache.org/tomcat-5.5-doc/manager-howto.html#Executing%20Manager%20Commands% 20With%20Ant - 或使用 Cargo 库对许多不同类型的服务器执行此操作 - http://货物.codehaus.org/

This is easiest if the web server has an auto-deploy facility, with a magic directory. Then just File-> Export the WAR file into the auto-deploy folder.

If not, or if you want to be able to debug the WAR file inside Eclipse you need to have an appropriate server connector in the WTP module (which is included by default in the Java EE edition of Eclipse).

If you want to programmatically push the WAR file to a given server directly from within Eclipse, then you can e.g. use the Tomcat Ant tasks - http://tomcat.apache.org/tomcat-5.5-doc/manager-howto.html#Executing%20Manager%20Commands%20With%20Ant - or use the Cargo library to do this with many different types of servers - http://cargo.codehaus.org/

滴情不沾 2024-08-30 23:31:44

我创建了自己的 ant 文件,并将 eclipse 设置为在构建时使用该 ant 文件。
ant 构建文件的一部分是发布到 Tomcat 的目标,因此我只需右键单击
并选择从 eclipse 内安装。

Eclipse 图片 http://img408.imageshack.us/img408/6701/eclipseant.png< /a>

这样的 ant 文件的基础在这里: http ://tomcat.apache.org/tomcat-6.0-doc/appdev/build.xml.txt

I created my own ant file, and set eclipse to use that ant file when building.
Part of that ant build file is a target that publishes to Tomcat, so I can just right click
and chose install from within eclipse.

Eclipse pic http://img408.imageshack.us/img408/6701/eclipseant.png

The basis of such an ant file is here: http://tomcat.apache.org/tomcat-6.0-doc/appdev/build.xml.txt

青春如此纠结 2024-08-30 23:31:44

是的,您这样做

  • 开始构建应用程序
  • 创建 war 文件
    WAR(或“web archive”)文件只是一个打包的 webapp 目录。它是使用标准 Java jar 工具创建的。例如:

cd /home/alex/webapps/mywebapp
jar cf ../mywebapp.war *
- 将该 war 文件复制到服务器中的以下部署目录
在Jboss中说是这样的
C:\Jboss405\server\default\deploy”

我希望这可能是清楚的,否则如果您遇到任何问题,请告诉我任何问题

Yes, you do that

  • Start the build the application
  • Create the war file
    A WAR (or "web archive") file is simply a packaged webapp directory. It is created using the standard Java jar tool. For example:

cd /home/alex/webapps/mywebapp
jar cf ../mywebapp.war *
- copy that war file to the following deploy directory in your server
say in Jboss its like this
"C:\Jboss405\server\default\deploy"

I hope this might be clear, else let me know any issues if you face any issues

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文