SoftwareEntwicklung Beratung Schulung

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

MojoHaus License Maven Plugin Version 1.9 Released

| Comments

The Mojo team is pleased to announce the release of the License Maven Plugin, version 1.9.

This plugin manages the license of a maven project and its dependencies (update file headers, download dependencies licenses, check thirdparty licenses, …).

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>license-maven-plugin</artifactId>
  <version>1.9</version>
</plugin>

Release Notes for License Maven Plugin Version 1.9

Enjoy,

The Mojo team.

Tony

How Important Is a Repository Manager?

| Comments

Do you know how many downloads are done from Maven Central during a month? I was not aware of that as well. As a PMC member of the Apache Maven Project I have the privilege of having access to the statistics of Maven Central.

So I checked the statistics of Maven Central. I can tell you that in the groupId org.apache.maven were more than 27 million (28,933,147) downloads in April 2016. This means in other words more than 964,438 downloads per day or more than 11 downloads per second.

The following chart gives you an impression of the trend over the last year.

Downloads of group org.apache.maven

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| Period  | Downloads |
| ------- | --------- |
| 04.2015 |  7,847,302|
| 05.2015 |  9,179,019|
| 06.2015 |  9,916,411|
| 07.2015 | 13,908,913|
| 08.2015 | 14,548,666|
| 09.2015 | 15,965,751|
| 10.2015 | 16,477,754|
| 11.2015 | 16,404,231|
| 12.2015 | 19,106,721|
| 01.2016 | 19,607,497|
| 02.2016 | 21,419,699|
| 03.2016 | 27,469,986| 
| 04.2016 | 28,933,147|

What are the consequences for you as a consumer of Maven Central? You should think about the load you are continously producing on the infrastructure of Maven Central.

But now the question arises what can you do? The simple answer is: Use a repository manager.

It does not matter if you are in a corporate environment or more or less alone. By using a Repository Manager you will reduce the load on Maven Central which is only one aspect of the story.

One other very important aspect is that you can release artifacts in your corporate environment into your repository manager without making it available to the public via Maven Central or other services like that.

And of course we should think about the future:

1
A long time ago in a galaxy far far away...

What does this mean? Simply if Maven Central might be down or vanishes away some time in the furture you have your own repository manager with all the artifacts needed to build your own artifacts within your network.

There are a few rules to use Maven Central to keep the stability of Maven Central. The most important one is that an released artifact is immutable. This means if you have published it to Maven Central the artifact can not be changed anymore. There does not exist an exception to that rule.

The NPM Problem has shown that those rules are very good rules. I did not understand why someone could simply change or delete artifacts from a repository that is consumed by other people. This breaks any reliability.

If it happens that someone really has to remove an artifact from Maven Central because of Copyright issues, then you are safe by using a repository manager cause you have a copy in your repository.

So running a repository manager is always a wise decision.

The Jenkins API Client for Java Version 0.3.5 Released

| Comments

We have released a new version of the The Jenkins API client for Java. The new released 0.3.5 contains several bugfixes and new features. Detailed information about the changes can be found in the release notes.

  • There had been several issues related to NPE. for example getUpstreamProjects(), getDownstreamProjects() which return null in case there is no such dependency. This has been fixed to return an empty list.

  • Also fixed possible NPE in relation ship with getLastBuild() etc.

The Jenkins API client for Java allows you to get informations about builds for example the duration of a build or test report informations.

Details API changes are documented in the release notes.

MojoHaus Exec Maven Plugin Version 1.5.0 Released

| Comments

The Mojo team is pleased to announce the release of the Exec Maven Plugin version 1.5.0.

The plugin helps with execution of system and Java programs.

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>exec-maven-plugin</artifactId>
  <version>1.5.0</version>
</plugin>

The Release Notes are available via GitHub Issue Tracker.

Enjoy,

The MojoHaus Team.

Building for Multiple Environments

| Comments

As i described in my previous articles (Multiple Environments I and Multiple Environments II) there are situations where you need to create separate artifacts for different environments.

But the problem is that by using the suggested solutions is that it can be made better.

Thats the reason why I’m writing this blog article.

I have created a more or less simple Maven Plugin which handles exactly those situations. Let us assume you have the following environments:

  • dev-01
  • test-01
  • prod

And now you need to create configurations for those different environments which usually means you need to create a set of configuration files which are different for each of those environments.

So you simply create the following folder structure in your Maven project:

1
2
3
4
5
6
7
8
9
src
  ├── main 
        ├── environments
             ├── dev-01
             │   └── first.properties
             ├── test-01
             │   └── first.properties
             └── prod
                 └── first.properties

So as an example the file first.properties contains some kind of configuration for your application.

By using the MultiEnv Maven Plugin you can now add the following to your pom.xml file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  <groupId>groupId</groupId>
  <artifactId>artifactId</artifactId>
  <version>0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>com.soebes.maven.plugins</groupId>
        <artifactId>multienv-maven-plugin</artifactId>
        <version>0.1.0</version>
        <executions>
          <execution>
            <goals>
              <goal>environment</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

As a result you can simply call Maven:

1
mvn clean package

which will result in three supplemental files:

  • artifactId-0.1-SNAPSHOT-dev-01.war
  • artifactId-0.1-SNAPSHOT-test-01.war
  • artifactId-0.1-SNAPSHOT-prodc-01.war

inclusive the base artifactId-0.1-SNAPSHOT.war file (Here I have assumed you are creating a war file).

Those files like *-dev-01.war contain the configuration of the appropriate folder which means you can deploy them into the appropriate environment.

The other solution is to create separate configuration packages which contain only the configuration for the separate environments. This can be done with the MultiEnv-Maven-Plugin as well. It provides a different goal for this purpose:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  <groupId>groupId</groupId>
  <artifactId>artifactId</artifactId>
  <version>0.1-SNAPSHOT</version>
  <packaging>war</packaging>
  ...
  <build>
    <plugins>
      <plugin>
        <groupId>com.soebes.maven.plugins</groupId>
        <artifactId>multienv-maven-plugin</artifactId>
        <version>0.1.0</version>
        <executions>
          <execution>
            <goals>
              <goal>configuration</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

So you can call Maven:

1
mvn clean package

which will result in three supplemental files:

  • artifactId-0.1-SNAPSHOT-dev-01.jar
  • artifactId-0.1-SNAPSHOT-test-01.jar
  • artifactId-0.1-SNAPSHOT-prodc-01.jar

Those artifacts only contain the configuration files of the appropriate environments and can be deployed to the appropriate environments as a separate package.

If you have ideas/wished/bugs etc. please use the issue tracking system of the plugin on Github.

Any feedback is appreciated.

The Jenkins API Client for Java Version 0.3.4 Released

| Comments

We have released a new version of the The Jenkins API client for Java. The new released 0.3.4 contains several bugfixes and new features. Detailed information about the changes can be found in the release notes.

  • There has been several issues related to HttpResponseException which occured this has been fixed in the current release.

  • You can now get the whole information about the installed plugins on a Jenkins Server if you have the appropriate permissions, cause the access to the pluginManager is defined an administrative permisions.

  • It is now also possible to get files from the workspace of a given job.

  • The job names are no cases sensitive as Jenkins itself.

  • The test cases now provided also the exceptions which happended during the tests.

  • It is possible to enable/disable jobs.

  • Enhanced the information about where a build has been done.

The Jenkins API client for Java allows you to get informations about builds for example the duration of a build or test report informations.

Details API changes are documented in the release notes.

Apache Maven Shared Component - Maven Archiver Version 3.0.2 Released

| Comments

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

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.0.2</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