Friday, July 12, 2013

Simple war deploy to Tomcat with Gradle

After observing and trying many different Tomcat deployment strategies, I decided to share my current pick.

The Goal: build the war and upload it into Tomcat's "webapps" directory. Should be simple. Thankfuly it is, using int128's Gradle SSH Plugin, a wrapper around JSch.

The main takeaway is that the Gradle SSH Plugin is a nice piece of work, but there are a few other things to note:

  • After the gradle war task has executed the path the new war is war.archivePath.absolutePath (usually in "build/libs").
  • If your deploying to Amazon EC2, (and who isn't?) you'll need to disable StrictHostKeyChecking.
  • Don't upload the war with a .war extension. Tomcat will attempt to start it before it's done copying, fail, and you will have to restart tomcat or screw around in the admin console.
  • Once it's finished uploading, and the old war is removed, then you can rename to .war.
This example doesn't take advantage of Tomcat 7's Parallel Deployment feature, but it could easily be extended to do so by naming the war things like appName##versionNumber.war.

Feel free to post your favorite Tomcat deploy edge cases in the comments!

Example tested with Tomcat 7 and Gradle 1.5.

Tuesday, February 5, 2013

If you want to believe what you read ... then actually read it

Snapped from Facebook before the thread was deleted. Names other than mine cropped out. 

This is the ritual.

1. Viral graphic on Pintrest shared by one of your friends.

Any truth found in this infographic is purely coincidental.

2. Semi-legit looking article apparently from MSNBC, titled "Want a Better Job? Top Jobs In America Revealed." It praises working online for companies like "Home Cash Success" as the #1 type of job in America, citing an annual review by Career Cast. Links to the Home Cash Success website which looks exceedingly shady.

3. Googling the phrase Home Cash Success, second result: Home Cash Success Scam. Snopes article is from 2009 but seems to be describing the same thing.

4. The actual 2012 review done by Career Cast, The 10 Best Jobs of 2012. Seems like a nice review and well researched. Says something completely different than the MSNBC article that cites it.

5. Upon attempting to write a letter to the editor informing NBCNews that one of their columnists screwed up and requesting a retraction, realize that the article is nowhere to be found from within

6. Re-inspect the first article link's domain, "" ... WAIT A MINUTE.

Should've caught that a lot sooner, honestly. I'm sure Mike Finney would've.

The specific facts here aren't important. It's the ritual. Skepticism is about more than the Shroud of Turin and Big Foot. It's even about more than being a smartass on social media. 

Critical thinking is a lifestyle. We live in a world filled with information, good and bad, whizzing past us as fast as we care to absorb it. If you're going to put some of it in your head, vet it.

(See also my 2008 post: The arrogance of demanding evidence)