Making Java web application development easier

If you have some web server where you deploy the web application in the exploded form and your source code is placed in another place for example in the local SVN copy – you have several options:

  1. Configure your IDE to deploy web application directly into your web server.
  2. Change your files in IDE and manually copy them into your exploded web application.
  3. Change your files in the exploded web application and manually copy them into your local SVN copy.

But there’s a much simpler way to have both copies in synchronize. If you’re on Linux – using symbolic links is a very easy way.

Just do:

ln -s ~/Sources/SITE/main.css ~/Tools/tomcat/webapps/ROOT/main.css

and once you edit ~/Sources/SITE/main.css in your IDE – the same contents will appear in ~/Tools/tomcat/webapps/ROOT/main.css. No need for manual synchronization.

You can do absolutely the same with the folders also.

However by default Tomcat does not follow symbolic links. To make it following symbolic links your need to add allowLinking=”true” attribute for your application context. Or you can do it globally for all of the Tomcat apps by adding allowLinking=”true” into conf/context.xml