tags:

views:

1668

answers:

5

I know about the export->war file

I would like something similar to the .jardesc that allows you to define the destination. So I could right-click on that .jardesc and do export. Except .wardesc instead of .jardesc :)

Is the war export functionality tied to an eclipse ant task?

I've put together an AHK macro so it will do the GUI motions for me... but that's a hack not a solution.

+1  A: 

Is the war export functionality tied to an eclipse ant task?

As far as I know, yes. You might try searching for a plugin that can do this for you; I found a couple, such as the war-plugin builder, but I haven't tried it myself, as I try to avoid using extra plugins in eclipse.

Nik Reiman
Ya... I like to keep the extra plugins as minimal as possible...
TJ
A: 

The right way to do "war export" is to use a build system (like Maven) and let it do the heavy lifting. All you need is a pom.xml with <packaging>war</packaging>.

Eclipse's exports are meant for occasional exports by humans, not for automation. And if you would really like to automate, do it right. You will benefit from other things, too. The same pom file will run on your machine, on other developers' machines and on your build server.

mhaller
I'm not looking for automated builds. I don't like the Eclipse server publish mechanism. So I'm using the war export as the same thing. Make some changes... publish and test... repeat.
TJ
A: 

Eclipse has the notion of external commands. If you can write e.g. an ant script that does the export the way you like it you can start it from the menu/button. For ant scripts you can also pick the ant target you want to call and pass properties. This allows you to edit e.g. the path name in the Launch Configuration.

lothar
+1  A: 

Theres a WAR ant task.

http://ant.apache.org/manual/CoreTasks/war.html

John Ellinwood
A: 

WAR ant task

http://ant.apache.org/manual/Tasks/war.html

from the documentation:

Assume the following structure in the project's base directory:

thirdparty/libs/jdbc1.jar
thirdparty/libs/jdbc2.jar
build/main/com/myco/myapp/Servlet.class
src/metadata/myapp.xml
src/html/myapp/index.html
src/jsp/myapp/front.jsp
src/graphics/images/gifs/small/logo.gif
src/graphics/images/gifs/large/logo.gif

then the war file myapp.war created with

<war destfile="myapp.war" webxml="src/metadata/myapp.xml">
  <fileset dir="src/html/myapp"/>
  <fileset dir="src/jsp/myapp"/>
  <lib dir="thirdparty/libs">
    <exclude name="jdbc1.jar"/>
  </lib>
  <classes dir="build/main"/>
  <zipfileset dir="src/graphics/images/gifs"
              prefix="images"/>
</war>

will consist of

WEB-INF/web.xml
WEB-INF/lib/jdbc2.jar
WEB-INF/classes/com/myco/myapp/Servlet.class
META-INF/MANIFEST.MF
index.html
front.jsp
images/small/logo.gif
images/large/logo.gif
Taveren