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

对着背影说爱祢 提交于 2019-12-10 15:01:35

问题


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


回答1:


yes you can.

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




回答2:


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.




回答3:


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.




回答4:


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/




回答5:


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!




回答6:


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




回答7:


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



来源:https://stackoverflow.com/questions/2407151/can-you-publish-a-war-directly-from-eclipse-to-a-web-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!