Deploy MVC Spittr war from Spring in Action 4th edition in external Tomcat Server on Linux Mint using IntelliJ IDEA 14

Install Tomcat 7

sudo apt-get install tomcat7

Disable Tomcat running on start-up

sudo update-rc.d tomcat7 disable

Shutdown Tomcat

sudo /etc/init.d/tomcat7 stop

Import the chapter05 Spittr project in the same way as I explained here

Add the local Tomcat Server in the run configuration

Use the new Server
Add the Spittr war (exploded) as an artifact
Start Tomcat in the Application Server Tool Window

Go to http://localhost:8080

Howto run chapter01 sample code from Spring in Action 4th edition on the command line

Add this to build.gradle:

task copyToLib(type: Copy) {
    into "$buildDir/libs"
    from configurations.runtime


This makes sure that the jar dependencies are copied to the lib directory,
when you build the project.

Save this in a batch or bash script file, in the Chapter_01 directory:


cd knight/build/libs
java -cp *:. sia.knights.KnightMain

windows (haven’t tested it, but this should work):

cd knight\build\libs
java -cp *;. sia.knights.KnightMain

(* adds all the jars to the classpath and . adds the current dir. to the classpath)

command line