Building a Flex project with Maven using Hudson on CentOS
The last days I’ve been trying to build a flex project with Hudson, as continuous integration server. Java projects worked fine from the start, but the flex project didn’t compiled entirely, as it should. I mean the swf application was getting generated properly, but the flex tests were not being executed. To drill down to the real problem I started to run the maven build with the “-X” flag, which enabled debug mode. Without this flag, the only error information I had was :
Unexpected return code 1
To make everything work I needed to do a proper setup in order to run flex unit tests with maven on my CentOS machine. I’m listing them here:
- Firstly, I had to make sure I have X11 server installed
- Then I needed Xvfb dependency, required by Flex Mojos ( See this article ). To install it, I used yum :
yum install XvfbIf you don’t have Xvfb installed, X server will try to load the unit tests into a graphical environment, making the build failing with the error:
Gtk-WARNING **: cannot open display: - After that, I saw there is another dependency for maven:
xvfb-run
This one was the most complicated part, because it was hard to find. I start searching on the internet and found a few versions, but none of the versions I found was especially made for X11. After a few tests, I ended up with a working version of xvfb-run from the “fake” X server, for Debian. You can also download here xvfb-run.sh .
- Now I was able to run xvfb-run, but maven was complaining that it can’t find any flashplayer executable :
/usr/bin/xvfb-run: line 168: flashplayer: command not found
The error was coming from the fact that the environment variables were not properly set for tomcat. I edited
/usr/shared/tomcat/…/tomcat5.conf
and I have added to the PATH, the full path of my flashplayer installation
- Eventually, the build succeeded but I still had an error saying :
[ERROR] Failed to delete Xvfb locking files, does the current user has access? java.io.IOException: File /tmp/.X11-unix/X0 unable to be deleted.
The fix was to change the owner for /tmp/.X11-unix to tomcat
chown -R tomcat:tomcat /tmp/.X11-unix
That’s it. These steps helped me build successfully my projects with maven and Hudson on CentOS.