SoftwareEntwicklung Beratung Schulung

A coders, hackers heaven.....Hm...I do not think so...

MojoHaus Build Helper Maven Plugin Version 1.11 Released

| Comments

The MojoHaus team is pleased to announce the release of the Build Helper Maven Plugin Version 1.11.

This plugin contains various small independent goals to assist with Maven build lifecycle.

To get this update, simply specify the version in your project’s plugin configuration:

1
2
3
4
5
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>build-helper-maven-plugin</artifactId>
  <version>1.11</version>
</plugin>

Spoiler Alert: Upcoming Maven 3.4.0 - Changes - II

| Comments

Currently the preparations for the upcoming Maven 3.4.0 release is running. There had been informations about the changes for the next Maven release.

I will give some more information about changes which are (might be!) part of the next Maven release.

Just be warned that you do not blame me if a particular issue will not part of the final release. This is written from the current perspecitve. So no warranty about that.

If you like to create source packages during the release you can use the defined state in the super pom, but unfortunately there is little issue with the default definitions which causes the generate-resources and the generate-sources life cycle phase to run twice based on the bound goal of the maven-source-plugin which forkes the life cycle. So a typical workaorund is to detach the maven-source-plugin form the life cycle via the following:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
  <pluginManagment>
    <plugins>
      ..
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>..</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <phase>DISABLE_FORKED_LIFECYCLE_MSOURCES</phase>
          </execution>
        </executions>
      </plugin>
      ..
    </plugins>
  </pluginManagment>
..

But to keep generating a source package during the release you need to add the following to your pom file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  <plugins>
    <plugin>
      <inherited>true</inherited>
      <artifactId>maven-source-plugin</artifactId>
      <executions>
        <execution>
          <id>attach-sources-no-fork</id>
          <inherited>true</inherited>
          <goals>
            <goal>jar-no-fork</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
  </plugins>

The above workaround is no longer needed cause the super pom has been changed accordingly to MNG-5940 and exactly contains the binding with the jar-no-fork goal.

Spoiler Alert: Upcoming Maven 3.4.0 - Changes

| Comments

Currently the preparations for the upcoming Maven 3.4.0 release is running. There had been informations about the changes for the next Maven release.

I will give some more information about changes which are (might be!) part of the next Maven release.

Just be warned that you do not blame me if a particular issue will not part of the final release. This is written from the current perspecitve. So no warranty about that.

I assume that you know filtering in resources can simply be achieved by configuring things like this in your pom file:

1
2
3
4
5
6
7
8
  ...
  <resources>
    <resource>
      <directory>src/main/resources</directory>
      <filtering>true</filtering>
    </resource>
  </resources>
...

But this configuration has one drawback. It will filter everything, except files with pre defined extensions like jpg, jpeg, gif, bmp, png.

Often in builds you need have supplemental files which should be filered or not filtered. So the consequence is to enhance the configuration and adding those extensions/folders etc. Or you know that you have some folders in that above tree which contain files which should not be filtered eithers. This often ends up with a bunch of includes/excludes etc. which is simply cumbersome.

The best and simplest solution would be having two different locations for filtered and non-filtered files. So a configuration in your pom could look like this:

1
2
3
4
5
6
7
8
9
10
11
  ...
  <resources>
    <resource>
      <directory>src/main/resources</directory>
    </resource>
    <resource>
      <directory>src/main/filtered-resources</directory>
      <filtering>true</filtering>
    </resource>
  </resources>
...

So this setup makes it easier and more clean where the files are located which will be filtered and the ones which will not. The same could of course be applied to the src/test area.

By improving the Conventions over Configuration paradigm in Maven 3.4.0 the super pom contains such an configuration for the src/main/resources, src/main/filtered-resources, as well as for the src/test/resources, src/test/filtered-resources.

Mojo Mock Repository Manager Plugin Version 1.0.0 Released

| Comments

Hi,

The MojoHaus team is pleased to announce the release of the Mock Repository Manager Maven Plugin version 1.0.0.

The Mock Repository Manager Plugin is used when you want to test Maven plugins against specific sets of dependencies in a repository.

This release has now Maven minimum 2.2.1 and JDK 6.

To get this update, simply specify the version in your project’s plugin configuration:

1
2
3
4
5
<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>mrm-maven-plugin</artifactId>
  <version>1.0.0</version>
</plugin>

Release Notes – Mojo’s Mock Repository Manager – Version 1.0.0

Enjoy,

The MojoHaus team.

Karl Heinz Marbaise

Apache Maven Source Plugin Version 3.0.1 Released

| Comments

The Apache Maven team is pleased to announce the release of the Apache Maven Source Plugin, Version 3.0.1.

The Source Plugin creates a jar archive of the source files of the current project. The jar file is, by default, created in the project’s target directory.

1
2
3
4
5
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-source-plugin</artifactId>
  <version>3.0.1</version>
</plugin>

You can download the appropriate sources etc. from the download page.

Apache Maven Shared Component - Maven Archiver Version 3.1.1 Released

| Comments

The Apache Maven team is pleased to announce the release of the Maven Archiver, version 3.1.1.

The Maven Archiver is mainly used by plugins to handle packaging. The version numbers referenced in the Since column on this page are the version of the Maven Archiver component – not for any specific plugin. To see which version of Maven Archiver a plugin uses, go to the site for that plugin.

You should specify the version in your project’s dependency configuration:

1
2
3
4
5
<dependency>
  <groupId>org.apache.maven.shared</groupId>
  <artifactId>maven-archiver</artifactId>
  <version>3.1.1</version>
</plugin>

You can download the appropriate sources etc. from the download page.

Important Notes since Version 3.0.0:

  • Maven 3.X only
  • JDK 6 minimum requirement

Maven Anti Patterns: Build Helper Maven Plugin

| Comments

In Maven builds I often see a pattern like the following:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<plugins>
  <plugin>
    <groupId>group</groupId>
    <artifactId>generatorPlugin</artifactId>
    <version>..</version>
    <configuration>
     ...
    </configuration>
  </plugin>
  <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <version>...</version>
    <executions>
      <execution>
        <phase>generate-sources</phase>
        <goals>
          <goal>add-source</goal>
        </goals>
        <configuration>
          <sources>
            <source>target/generated-sources/WHATEVER</source>
          </sources>
        </configuration>
      </execution>
    </executions>
  </plugin>
</plugins>

The generatorPlugin is just a placeholder for different kinds of maven plugins which generate code for example ANTLR4 Maven Plugin, Templating Maven Plugin, JAXB2 Maven Plugin just to mention a few examples here.

Usually this can be reduced to the following:

1
2
3
4
5
6
7
8
9
10
<plugins>
  <plugin>
    <groupId>group</groupId>
    <artifactId>generatorPlugin</artifactId>
    <version>..</version>
    <configuration>
     ...
    </configuration>
  </plugin>
</plugins>

The reason is simple, cause those plugins already handle the task to add the generated source code to the correct parts in Maven to give for example the Maven Compiler Plugin a hint to compile also those generated java code.

Yes I know there are some of such plugins out there which do not do it in the correct way which means you need to add the Build Helper Maven Plugin snippet, but this means those plugins need some improvements. Those plugins violate the Convention over Configuration paradigm. Why? Simply cause you as user need to think about an internal detail of those plugins which is simply wrong. They have to handle that on their own.

A further note here. I do not say Build Helper Maven Plugin is wrong. It is the usage of the Build Helper Maven Plugin in the described relationship.

Apache Maven JavaDoc Plugin Version 2.10.4 Released

| Comments

The Apache Maven team is pleased to announce the release of the Apache Maven JavaDoc Plugin, version 2.10.4.

The Javadoc Plugin uses the Javadoc tool to generate javadocs for the specified project.

Please be aware of the new location of our issue tracker which has been moved from Codehaus to Apache Software Foundation.

1
2
3
4
5
<plugin>
  <groupId>org.apache.maven.plugins</groupId>
  <artifactId>maven-javadoc-plugin</artifactId>
  <version>2.10.4</version>
</plugin>