How to symbolic link a directory to Tomcat's webapp

Dec 18, 2015  | by Haixing Hu

I found that using the command sudo mount –bind olddir newdir gets me out of trouble. If you don’t have root access then this won’t work for you. See mount --help or man mount for some more info on binding but it basically mounts one directory on top of another so it has the same affect as a symlink but it gets around tomcat’s limitation with symlinks.

More precisely, executes the following command:

sudo mount --bind /path/to/your/app /var/lib/tomcat7/webapps/myapp

and then the /var/lib/tomcat7/webapps/myapp will be linked to /path/to/your/app.

How to implements the 'drop user if exists' in MySQL

MySQL has no DROP USER IF EXISTS ... syntax.

The following code imexplicitly creates the user and then drop the user.

GRANT USAGE ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password';
DROP USER 'username'@'localhost';


Feb 22, 2015  | by 佚名















Maven over SOCKS proxy

Jun 20, 2014  | by Haixing Hu

Setup a SSH tunnel to as SOCKS proxy:

ssh -D 8085

Now tell maven to use the proxy we just created:

mvn -U clean install -DsocksProxyHost= -DsocksProxyPort=8085

Or export it to env for convenience.

export MAVEN_OPTS="-DsocksProxyHost= -DsocksProxyPort=8085"

How to create a manifest file with Maven

This tutorial will show you how to use the maven-jar-plugin to create a manifest file, and package / add it into the final jar file. The manifest file is normally used to define following tasks :

  1. Define the entry point of the Application, make the Jar executable.
  2. Add project dependency classpath.

© 2015 Haixing Hu with help from Jekyll Bootstrap and Twitter Bootstrap
This work is licensed under a Creative Commons License