Setting Up Jenkins on Red Hat 6.5

We recently set up a new Jenkins installation on Red Hat development box. Here are the steps.

1. SSH into the Red Hat server.

2. Setup need root access, so use either sudo, or login or su as root. Here we are running the su command.

> su root

3. Add Jenkins to your Yum repository, then install Jenkins.

> wget -O /etc/yum.repos.d/jenkins.repo
> rpm --import
> yum install jenkins

4. Jenkins runs on port 8080 by default. Port 8080 is a common port used by other applications so we are going to change it to 8081 instead. We’ll also disable AJP since we don’t need it.

> vi /etc/sysconfig/jenkins

5. We were getting an “java.lang.UnsatisfiedLinkError” error when we tried to start Jenkins. The fix is to change the tmp directory.

> vi /etc/sysconfig/jenkins
> mkdir /var/lib/jenkins/tmp
> chown jenkins.jenkins /var/lib/jenkins/tmp

6. Start Jenkins. Tail the log just to make sure things are okay.

> service jenkins start
> tail -f /var/log/jenkins/jenkins.log

7. Open a browser and go to the freshly installed Jenkins instance.


7. To stop or restart Jenkin, run these

> service jenkins stop
> service jenkins restart

Excluding Folders in Play Framework 2.2 dist

We have a Play Framework 2.2 application that uses Gulp to optimize the public files. Gulp uses Node.js and it creates a public\node_modules directory. We don’t need the node_modules directory at runtime so we want to remove it when running the Play “dist” command.

1. In build.sbt, add the following lines.

mappings in (Compile, packageBin) ~= { _.filterNot { case (_, name) =>

packageBin is the task that creates the project JAR under Compile scope. mappings are the files used during compilation and packaging. We filter out all the files that are under “public\node_modules”.

2. We also want to to remove the share folder. So we added the following lines in build.sbt as well.

doc in Compile <<= / "none")

XSD to JAR using JAXB Binding Compiler

Here are the contents of our batch file that converts a .xsd file into a .jar file. It uses xjc, so you can use JAXB to  convert objects to XML and vice versa.

@echo off

set INPUT_XSD=..\sample.xsd
set OUTPUT_JAR=sample.jar

mkdir ~dir
cd ~dir

xjc.exe %INPUT_XSD%

dir /s /B *.java > ~list
javac @~list
del ~list

jar cf ../%OUTPUT_JAR% *

cd ..

rmdir ~dir /s /q