Tuesday, September 16, 2008

How to use formated maven2 timeStamp and buildNumber using buildnumber-maven-plugin mojo?

Today I was wondering how to use a formatted build timestamp and the current svn build version in your maven pom using the buildnumber-maven-plugin mojo, as most of the postings I found say it doesnt work. But it does. Read on.

The trick is to use two execution sections, one for the buildNumber (the current svn version) and another one for the formated timestamp, but this time we store the value in a new property called buildTimestamp.

With this, you can use the two properties ${buildNumber} and ${buildTimestamp} wherever you want.
Tip: Define the plugin in the main pom.xml file. It gets executed in every maven sub module.


<plugins>
<plugin>
<groupid>org.codehaus.mojo</groupid>
<artifactid>buildnumber-maven-plugin</artifactid>
<executions>
<execution>
<!-- buildNumber -->
<id>generate-buildNumber</id>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
<configuration>
<docheck>false</docheck>
<doupdate>false</doupdate>
</configuration>
</execution>
<execution>
<!-- buildTimestamp -->
<id>generate-timestamp</id>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
<configuration>
<format>{0,date,yyyy-MM-dd_HH-mm}</format>
<items>
<item>timestamp</item>
</items>
<docheck>false</docheck>
<doupdate>false</doupdate>
<buildnumberpropertyname>buildTimestamp</buildnumberpropertyname>
</configuration>
</execution>
</executions>
</plugin>
</plugins>

Monday, September 15, 2008

CentOS 4 - How to remove old Kernel versions?

Over time you get many obsolete kernel versions in CentOS4 (or RedHat Server 4).
The yum update feature installs new kernel versions, but doesn't remove old ones.

This fills up /boot more and more.

Here is how to get rid of the old kernel versions in a clean manner:

What kernels are installed:
yum list installed | grep -i kernel

Uninstall old version kernel-VERSION
Example: yum remove kernel-2.6.9-67.0.22.EL

Warning: Do not deinstall the most recent version. You might hose your system...

Tip:
On a SMP system, CentOS installs both UP and SMP versions of the kernel.
Therefore, remove both kernels.

CentOS5 by default keeps only the 4 most recent kernel versions. Therefore, no action must be performed on this system.