Kengo's blog

Technical articles about original projects, JVM, Static Analysis and TypeScript.

Maven tips in my repository

Currently my GitHub has 22 repositories. I think reading all of them is little hard.
So I've picked up some tips from them, they'll be helpful for you.

rejecting old maven

To force user to use new Maven, you can use prerequisites property.

<prerequisites>
	<!-- you should use 3.0.4 or higher -->
	<maven>3.0.4</maven>
</prerequisites>
update: for Maven3 2012/June/13

You have to use Require Maven Version plugin for Maven3.

using latest hamcrest

The latest junit depends on hamcrest-core 1.1, and it isn't latest. If you wants to use latest hamcrest, you have to use junit-dep instead of junit.

<dependency>
	<groupId>junit</groupId>
	<artifactId>junit-dep</artifactId>
	<version>4.10</version>
	<scope>test</scope>
</dependency>
<dependency>
	<groupId>org.hamcrest</groupId>
	<artifactId>hamcrest-all</artifactId>
	<version>1.1</version>
	<scope>test</scope>
</dependency>

avoiding javadoc warnings caused by Mojo annotations

Mojo uses javadoc annotation as parameter, but maven-javadoc-plugin cannot handle it correctly and prints a lot of warnings.
You have to configure tagletArtifact like below.

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-javadoc-plugin</artifactId>
	<version>2.8.1</version>
	<configuration>
		<!-- avoiding javadoc warnings caused by Mojo annotations -->
		<tagletArtifacts>
			<tagletArtifact>
				<groupId>org.apache.maven.plugin-tools</groupId>
				<artifactId>maven-plugin-tools-javadoc</artifactId>
				<version>2.9</version>
			</tagletArtifact>
		</tagletArtifacts>
	</configuration>
</plugin>

repository for args4j

In some years ago, we used m.g.o-public to get args4j. But currently it doesn't work well. We have to use Maven repository for Jenkins.

<repositories>
	<repository>
		<!-- repository for args4j -->
		<id>maven.jenkins-ci.org</id>
		<url>http://repo.jenkins-ci.org/public</url>
	</repository>
</repositories>