tags:

views:

2605

answers:

4

It's 5 button clicks to get eclipse to create a deployable war file for my eclipse project, I figure there's probably some eclipse command line option to do the same thing, so I can just write it into a script, but I'm not seeing it.

+3  A: 

Use the Ant war task, set up a relevant build file and you can just hit the "external tools" button to execute it.

Jon Skeet
Yeah, I can write an ant script, and I did, but it seems to me that all the code to do what I want already exists in eclipse, I would hope that there's a command line option to run that code since it is already very good at building my application.
stu
A: 

You could also setup a Maven build for your web project. Typing mvn package from the command line would then build the project for you.

For integration between Maven and Eclipse, see m2Eclipse and Maven Eclipse Plugin.

Mattias Holmqvist
+1  A: 

I cannot say anything about the WAR packaging itself, sorry.

But as I wrote in http://stackoverflow.com/questions/347698/how-do-i-automatically-export-a-war-after-java-build-in-eclipse : If you can describe the WAR packaging with an Ant script, you can have that Ant script being executed automatically after each change to your project. Use Project->Properties->Builders->Add->Ant Builder. Give that builder you custom Ant script and it will automatically be executed after the "normal" builders of your project. You can even specify in the settings of the builder, if it shall only react on changes to specific files and so on.

The Ant builder is kind of a Swiss army knife for anything you want to automate in the project build without having to use the big tools like maven.

Bananeweizen
A: 

This question has been answered with a couple of different solutions in this thread.

mikek