tags:

views:

289

answers:

2

I'm currently fixing a JSP project and it currently has a seemingly random collection of .class files in it's Tomcat's WEB-INF folder. As a way of simplifying this, I was planning to get .java files from these classes straight from SVN to WEB-INF folder on server and I got that to work but what would be the simplest way of compiling these? Of course I could create a cronjob which would compile all the classes during the night but it seems like a bit of hassle.

I know that our project management is a bit f*cked up and the correct of deploying applications on to a server would probably be to use WAR files. I'm trying to fix this in small incremental steps because the project is quite large and in use all the time.

+3  A: 

Tomcat only compiles the .jsp files, so you'll have to do the compile the .java files yourself, one way or another.

Most robust solution would be to create an ant task that built a .war file for the entire project and then pushed that to Tomcat (or use Maven2 to achieve same). While that will require some work now, it will save you a ton of effort in the long run.

Kris
+1  A: 

You might consider building a jar file from the *.java files on your build/dev box, then pushing that jar file to the server. Storing class files in VCS is a really bad idea.

Another approach might be to do the following

Assuming:

/opt/apache-tomcat/

Holds your app server, create something like this:

/opt/build/

Check out your files into the build directory then use one or more scripts to copy

/opt/build/my-app/ --> /opt/apache-tomcat/webapps/my-app/

Once you have that kind of working, try to get a repeatable (and verifiable) build working. Ideally a war file.

sal