How to compile and install newest version of maven and checkstyle (from github) using a bash script in Ubuntu 14.04 LTS 64-bit

Posted: 2015/04/04 in Ubuntu
Tags: , , , , , , , ,
# based on: http://checkstyle.sourceforge.net/cmdline.html
# Install tools required to build maven and checkstyle:
cd
sudo apt-get update
sudo apt-get build-dep maven maven2
sudo apt-get install git build-essential checkinstall unp ant
sudo apt-get purge maven maven2
# install newest version of maven:
rm -rf maven*
git clone https://github.com/apache/maven.git
cd maven
ant -Dmaven.home="$HOME/apps/maven/apache-maven-SNAPSHOT"
cd ~/maven/apache-maven/target
unp apache-maven-*-bin.tar.gz
sudo ln -s ~/maven/apache-maven/target/apache-maven-*/bin/mvn /usr/bin/mvn
mvn -v
# example of Terminal output:
#Apache Maven 3.3.2-SNAPSHOT
#Maven home: $HOME/maven/apache-maven/target/apache-maven-3.3.2-SNAPSHOT
#Java version: 1.7.0_76, vendor: Oracle Corporation
#Java home: /usr/lib/jvm/java-7-oracle/jre
#Default locale: en_US, platform encoding: UTF-8
#OS name: "linux", version: "4.0.0-040000rc3-lowlatency", arch: "amd64", family: "unix"
# install newest version of checkstyle:
cd
rm -rf checkstyle
git clone https://github.com/checkstyle/checkstyle
cd checkstyle
mvn clean compile
# Terminal output should be similar to this:
# [INFO] Executed tasks
# [INFO] ------------------------------------------------------------------------
# [INFO] BUILD SUCCESS
# [INFO] ------------------------------------------------------------------------
# [INFO] Total time: 45.184 s
# [INFO] Finished at: 2015-04-04T10:54:52+02:00
# [INFO] Final Memory: 32M/412M
# [INFO] ------------------------------------------------------------------------
#mvn exec:java -Dexec.mainClass="com.puppycrawl.tools.checkstyle.Main" \
# -Dexec.args="-c /sun_checks.xml src/main/java "
# run the tool in GUI mode:
mvn exec:java -Dexec.mainClass="com.puppycrawl.tools.checkstyle.gui.Main" \
 -Dexec.args="src/main/java/com/puppycrawl/tools/checkstyle/Checker.java"
#mvn clean package -Passembly
#java -jar target/checkstyle-6.5-all.jar -c /sun_checks.xml MyClass.java
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s