Maven - Build

> Maven

1 - About

A Build is just a run of maven.

Advertising

3 - Plugin

3.1 - LICENSE, NOTICE,...

See build-helper-maven-plugin

Example: Make sure every sub-project has LICENSE, NOTICE and git.properties in its jar's META-INF directory

<plugin>
	<groupId>org.codehaus.mojo</groupId>
	<artifactId>build-helper-maven-plugin</artifactId>
	<executions>
	  <execution>
		<id>add-resource</id>
		<phase>generate-resources</phase>
		<goals>
		  <goal>add-resource</goal>
		  <goal>add-test-resource</goal>
		</goals>
		<configuration>
		  <resources>
			<resource>
			  <directory>${top.dir}</directory>
			  <targetPath>META-INF</targetPath>
			  <includes>
				<include>LICENSE</include>
				<include>NOTICE</include>
			  </includes>
			</resource>
			<resource>
			  <directory>${top.dir}/target</directory>
			  <targetPath>META-INF</targetPath>
			  <includes>
				<include>git.properties</include>
			  </includes>
			</resource>
		  </resources>
		</configuration>
	  </execution>
	</executions>
</plugin>

3.2 - Build Info

  • In War (META-INF/build-info.properties)

Example:

build.group=com.example
build.artifact=demo
build.name=Demo Project
build.version=0.0.1-SNAPSHOT
build.time=2016-03-04T15\:16\:05+0100

Plugin:

A build-info file may also be created with resources filtering in Maven.

Retrieve information from VCS:

Advertising
maven/build.txt · Last modified: 2017/05/30 22:01 by gerardnico