Posts tagged maven

Deliberate Change Management

Software engineering can be described as the orchestration of a quasi-denumerable set of moving parts.

With so many moving parts, breakages occur. One main goal as a “software craftsperson” is to never expose customers to the affects of these breakages. Test-driven development rose from this desire. Accepting that systems break, even in production, motivated loosely coupled and shared-nothing system architectures.

More >

How to increase maven heapspace in hudson builds

If your maven-built project fails in hudson (especially when you’re using the assembly plugin) and it isn’t a compile or test failure, check the console output. If it says “java.lang.OutOfMemoryError: Java heap space”, you need to configure your hudson job to add heap space to the maven process.

  1. Navigate to your hudson job,
  2. click Configure,
  3. scroll down to the Build section, and
  4. click the Advanced button.
  5. Enter this into MAVEN_OPTS: -Xmx512m -XX:MaxPermSize=128m

More >

How to add a version number to your hudson-built maven jar

Maven’s jar plugin will automatically add a “pom.properties” in your jar’s META-INF/maven/$groupId/$artifactId directory. If you build with hudson, there are a number of other values that you might want to include automatically, though, like the SVN revision number that the artifact was built from, and when it was built.

Here’s the configuration for the maven-jar-plugin that adds a couple of the more-interesting hudson variables to your module’s jar’s META-INF/MANIFEST.MF:

<project>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>2.2</version>
        <configuration>
          <archive>
            <manifestEntries>
              <Svn-Revision>${SVN_REVISION}</Svn-Revision>
              <Build-Tag>${BUILD_TAG}</Build-Tag>
              <Build-Number>${BUILD_NUMBER}</Build-Number>
              <Build-Id>${BUILD_ID}</Build-Id>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>

The Maven Guide to Working with Manifests and Maven Archiver pages, along with the other hudson variables may prove helpful.

Update December 14, 2009:

Note that Hudson’s SVN_REVISION macro is empty if you build your project as a maven multi-module.

How to add a version number to your maven webapp

I couldn’t find a simple recipe to add a version number to a maven-built webapp. The maven-war-plugin talks about how to filter, but no simple example is given.

More >