PDA

View Full Version : Building webapp from command line


kjkoster
31-03-2009, 10:06
Dear All,

Sometimes you just want to have a quick bit of shell script to build a webapp on a server for use in Tomcat. IDE's are nice for development, but for automated deployments you may need something a lot more straightforward.

Here is what I have in my deployment scripts. These check out the sources from an SVN server and then build the application on the server. That way I can be sure that all deployment artefacts are properly committed to the SVN server.


JAVA_HOME=/usr/local/jdk1.6.0
export JAVA_HOME

cd webapp/WEB-INF/classes

tomcat=`echo ../../../apache-tomcat-*`
classpath=${tomcat}/lib/jsp-api.jar:${tomcat}/lib/servlet-api.jar
for jar in `find ../lib -name \*.jar -print`; do
classpath=${classpath}:${jar}
done

find . -name \*.class -exec rm -f {} \;
${JAVA_HOME}/bin/javac -Xlint -classpath ${classpath} -d . `find com -name \*.java -print` `find org -name \*.java -print`


Kees Jan