By default, Maven’s test plugin Surefire doesn’t scan files for @Test annotations, but rather takes only the files which class names ends with “Test” or “TestCase”.

I use both: unit tests and integration tests. I execute the latter using Arquillian framework, so it looks just like pure JUnit test. However, I prefer to name them with the “IT” suffix which means that they’re no longer recognized by Surefire plugin as test files.
If you want Maven to execute such tests, you need to give him a hint (using appropriate configuration element) to scan also for the *IT classes:


Just remember that the regex works only on *.class files. It also overrides the default rules (which means that you need to add the *Test and/or the *TestCase suffix to scan for default test classes.)

If you’re using BASH find and want to find files which are named differently than the given pattern, you can use the following syntax:

find . -type f ! -iname "*.class"

The above command will find all files in the current directory (and subdirectories) which have the extension different (exclamation mark) from “class” (case insensitive).

You can also use conditional operations to build slightly more complicated commands, like:

find . -type f ! \( -iname "*.class" -o -iname "*.jar" \)

The above command uses the OR operation to find all files in the current directory (and subdirectories) which have extension different than “class” or “jar”. Don’t forget about the parentheses escaping!

Didn’t need this feature before today, but I guess it might be quite handy.

I wanted to find some solution to a problem of automatic generation of build numbers/version identifiers using an ANT. I figured out that I can achieve it in the following way:

<target name="numerate.version"
        description="Generates version number and sets it in
                     Client properties file.">
        <format property="build.time"
                unit="hour" />

    <buildnumber file="build.number" />

    <property name="version.code"
              value="${build.version}/${build.time}/${build.number}" />

    <echo>Version: ${version.code}</echo>

    <replaceregexp file="${}"
                   match="(version[ \t]*=[ \t]*)+.*$"
                   replace="\1${version.code}" />

A short description what is going on:

  • tstamp is generating an actual date in given format (yy-MM-dd_hh:mm) and saves it as a property (build.time),
  • buildnumber saves the incremented number of build in a file (build.number),
  • replaceregexp replaces the given expression (version[ \t]*=[ \t]*)+.*$) with a following expression (\1${version.code}). In other words – in this example, it replaces the old build/version number with the new one.

The last part (replaceregexp) is used to get the most recent version number in the *.properties file which can be printed on the presentation layer (i.e. on the page footer). You can achieve it using the GWT i18n features, which uses the properties files for international labels generation.
Needles to say, this target should be invoked before the actual GWT compilation.
An example of generated build/version number using this script is as follows: