Write build.xml file (ANT) for compiling and generating WAR file

Hey there!

I’m trying to write a build.xml file to compile and package my vaadin project into a war package.

As I can see, to create the WAR file what is needed is to pack into the WAR the content of META-INF, VAADIN and WEB-INF folders. This would be straightforward.

But how to compile the whole project with ANT?

Additionally, I have found a tool which let’s you do what ANT offers you (for instance creating a WAR file) plus deploying the WAR file to a local or to a remote Tomcat server (say, it supports multiple servers like jboss or glashfish): codehaus-cargo.github.io
Would it be possible to use it with vaadin?

I appreciate your help.

Unfortunately, I don’t think it’s documented well anywhere. Oddly, I can’t find an example zip file from the website anymore.

The
build.xml for the book-examples
should offer a rather clean example. Most settings can be done in the beginning of the build script, although there’s some important things that you need to set in the compilation targets, such as what application-specific files to include and exclude.

For remote deployment, you can probably use many existing deployment tools. I’ve seen people often use just scp+ssh; first scp the WAR to a staging directory and then move to the Tomcat’s webapps directory. Then perhaps have a script check that the deployment succeeded by accessing it with HTTP request.

Thanks for your help.

I found a repository of a buddy which exemplifies the creation of ANT files for building a Vaadin 7 project: https://github.com/canthony/simple-vaadin-7-compile-widgetset-ivy

I have been able to get it to work. What I’m doing now is to figure out how to add the Cargo functionality to this existing ANT build.xml file.

I’ll report my advances.