These projects have different environments (e.g. java 1.5 and maven 2.2.1 on one, java 1.6 and maven 2.0.9 on the other one).
In order to have information about the projects quickly available, I display some version information in the terminal title.
I often set up a end.sh script that contains my project specific environment setup.
My [Ubuntu] .bashrc is modified like this:
function versions {
mvn_version=`mvn --version | grep "Maven" | cut -d ':' -f 2`
jdk_version=`mvn --version | grep "Java" | cut -d ':' -f 2`
svn_version=`svn --version | grep "^svn"`
}
function prompt_extra { echo ""
}
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
export PROMPT_COMMAND_EXTRA=`prompt_extra`
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~} - $PROMPT_COMMAND_EXTRA\007"'
;;
*)
;;
esac
Then my per project environment scripts that look like:
export MAVEN_HOME=/usr/local/lib/apache-maven-2.0.9
export PATH=$MAVEN_HOME/bin:$PATH
versions
function prompt_extra { echo "MVN:$mvn_version JDK:$jdk_version $svn_version"
}
reset_prompt
No comments:
Post a Comment