john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

jenkins maven git build machine java ubuntu 12.04

java 7 on ubuntu 12.04.1

sudo apt-get update
sudo apt-get upgrade
sudo apt-get install openjdk-7-jdk maven        # 500+ MB as maven3 uses Java6

java --version
mvn --version       # reveals Maven home: /usr/share/maven

IF NECESSARY: create and customize ~/.m2/settings.xml


apt-get install git-core

mkdir ~/.ssh
ssh-keygen -t rsa     (ssh-keygen -t dsa  = protocol 2)
chmod 400 id_rsa

git clone git@server.com:reponame.git   # Test connectivity + ssh key
cd directory-with-pom-xml  # ensure this is the root ancestor parent
mvn clean validate  # test maven configuration and ensure dependencies are downloaded properly
e.g.  mvn -DCOMMON_VERSION_NUMBER=2.0.0-SNAPSHOT clean install

wget http://mirrors.jenkins-ci.org/war/latest/jenkins.war
java -jar jenkins.war

http://10.10.10.233:8080/
http://10.10.10.233:8080/manage
http://yourhost/jenkins/pluginManager  (Available tab)
Git Plugin (download and install and restart browser)
    OR by hand http://updates.jenkins-ci.org/download/plugins/
    THEN download the *.hpi file into the $JENKINS_HOME/plugins

http://10.10.10.233:8080/manage -> CONFIGURE
http://10.10.10.233:8080/configure
Git (Add Git) -> APPLY
Maven (Add Maven) -> /usr/share/maven -> APPLY


http://10.10.10.233:8080/view/All/newJob
Build a maven2/3 project
Source Code Management = Git -> git@server.com:reponame.git
If necessary customize: Build -> Root POM
                        Build -> Goals and options (e.g. clean test package install)
                        ADVANCED -> MAVEN_OPTS = -DCOMMON_VERSION_NUMBER=2.0.0-SNAPSHOT

Pre Steps (use shell and environment variables like BUILD_NUMBER, BUILD_ID, WORKSPACE, etc.)

NOTE: WORKSPACE refers to ~/.jenkins/jobs/JOBNAME/workspace (e.g. this is where git clone ends up)

 mvn -DCOMMON_VERSION_NUMBER=2.0.0-SNAPSHOT -f ~/acmeserver-common/acmecloudservice/parentservercommon/pom.xml clean install

http://10.10.10.233:8080/exit       # shut down jenkins

  • « django blog INCOMPLETE
  • eclipse shortcuts preferences customize syntax text color run as commandline »

Published

Jan 14, 2013

Category

java

~198 words

Tags

  • 12.04 2
  • build 3
  • git 8
  • java 252
  • jenkins 1
  • machine 4
  • maven 10
  • ubuntu 30