Nothing special. just bits and pieces about my life, my career and my loves.

Thursday, October 25, 2007

Buildix + Maven2 Part 3

When using maven2, instead of downloading all the jars from the internet, you should setup your local internal repository and use it as a maven proxy. It's pretty simple, if you try a retrieve a jar file that is not exists in the internal repository, the internal repository will download it from the internet and then cache it, so that next time when you need it again, you can get it off the cache. This will save your time and bandwidth. The other purpose of using an internal repository is you can publish your jar/war/ear files, so that it can be used by other team members.

There are many open source maven2 repositories out there, e.g. Archive, Proximity and Artifactory. I've chosen Artifactory because it's the most active project. It has good documentation and it's is very simple to install and use.

Artifactory can be run as a standalone java application or you can deploy it as a war file. Since Buildix comes with tomcat5, so I decided to put it there.


Download Artifactory and then extract it to /usr/share/artifactory-1.X.X as root

Add the -Dartifactory.home argument in /usr/share/tomcat5/bin/catalina.sh
JAVA_OPTS=" -Xms128m -Xmx384m -Dartifactory.home=/usr/share/artifactory-1.2.2 "
export JAVA_OPTS

Copy the configuration file to /usr/share/artifactory-1.X.X/etc/artifactory.config.xml

Create 3 directories logs, backup and data under /usr/share/artifactory-1.X.X and then chown these directories to cruise

To deploy Artifactory into tomcat, you need to create a simlink in /usr/share/tomcat5/webapps

Finally, login as cruise and go to added a new profile in the settings.xml (if not exists) under the directory ~/.m2

<profile>
<id>profile-id-internal-repo</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>central</id>
<url>http://buildix.hostname/artifactory/repo</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>snapshots</id>
<url>http://buildix.hostname/artifactory/repo</url>
<releases>
<enabled>false</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>central</id>
<url>http://buildix.hostname/artifactory/repo</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
<pluginRepository>
<id>snapshots</id>
<url>http://buildix.hostname/artifactory/repo</url>
<releases>
<enabled>false</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
</profile>


That's it!! You may now go to http://buildix.hostname/artifactory and verfiy it by login as admin/password.

Buildix + Maven2 Part 2

Buildix uses ant by default, therefore, we need to install maven into the build server.
Follows the instructions in maven website to install maven to /usr/share/maven-2.0.7

Added $M2_HOME in /etc/profile
M2_HOME=/usr/share/maven-2.0.7
PATH="$PATH:$M2_HOME/bin"

make sure mvn -version is working and you would be ready to go!!

If you have a lot of projects and a very large scale project, we may need to increase cruise control heap sizes by modifying the following:
/usr/share/cruisecontrol/bin/cruisecontrol.sh

By default, if you create a new project using the "create_project" script, it will update the cruisecontrol.xml with Ant configuration. For maven2, we need to change the template from ant to maven.

Replace /usr/local/buildix/lib/cruisecontrol.fragment with the following codes:
<project name="@MY_PROJECT@" buildafterfailed="false">

<labelincrementer defaultLabel="${project.name}-1" separator="-"/>

<listeners>
<currentbuildstatuslistener file="/var/spool/cruisecontrol/logs/@MY_PROJECT@/currentbuildstatus.txt"/>
</listeners>

<modificationset quietperiod="30">
<svn RepositoryLocation="http://localhost/svn/@MY_PROJECT@/trunk/@MY_PROJECT@" username="cruise" password="cruise" />
</modificationset>

<bootstrappers>
<svnbootstrapper localWorkingCopy="/var/spool/cruisecontrol/tools"/>
<svnbootstrapper localWorkingCopy="/var/spool/cruisecontrol/@MY_PROJECT@" />
</bootstrappers>

<schedule interval="60">
<maven2 mvnscript="/usr/share/maven-2.0.7/bin/mvn" pomfile="/var/spool/cruisecontrol/@MY_PROJECT@/pom.xml" goal="clean install deploy" />
</schedule>

<log dir="logs/@MY_PROJECT@">
<merge dir="@MY_PROJECT@/target/surefire-reports" />
</log>

<publishers>
<onfailure>
<email mailhost="192.168.X.X" buildresultsurl="http://buildix_hostname/cruisecontrol/buildresults/@MY_PROJECT@?tab=buildResults" returnaddress="DevelopmentTeam@host.com">
<always address="DevelopmentTeam@host.com" />
</email>
</onfailure>
</publishers>

</project>
</cruisecontrol>

you are now ready to create a maven2 project in Buildix

Wednesday, October 17, 2007

IS250X


I've traded in my Euro with a brand new Lexus IS250X last week.

Euro is an excellent car with its price, however, I would like some a bit more luxury.

My new car is in black and it comes with 18" alloy wheel.

The car is very easy to handle, isolation is good. Although I think the car will be better with more torque, it's still an excellent car, really pleasure to drive with.

The car that parks itself

This is really impressive

http://www.news.com.au/dailytelegraph/story/0,22049,22596564-5006009,00.html