Maven

Setup Maven

Download and install the latest maven version (tested with maven 3.5.4).

The installation of Apache Maven is a simple process of extracting the archive and adding the bin folder with the mvn command to the PATH.

Detailed steps are:

  • Ensure JAVA_HOME environment variable is set and points to your JDK installation
  • Extract distribution archive in any directory
Tip

For windows user unzip to C:\Program Files\apache-maven-<version>

unzip apache-maven-<version>-bin.zip

or

tar xzvf apache-maven-<version>-bin.tar.gz

Alternatively use your preferred archive extraction tool.

  • Create environment variable M2_HOME to point the created directory apache-maven-<version>
  • Add the bin directory of the created directory apache-maven-<version> to the PATH environment variable
  • Confirm with mvn -v in a new shell. The result should look similar to
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T20:33:14+02:00)
Maven home: /opt/apache-maven-3.5.4
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.8.5", arch: "x86_64", family: "mac"

Setting up visiativ repository

To be able to use visiativ repository you must add somme configuration in ~/.m2/settings.xml.

Info

If the file dose not existe copy $M2_HOME\apache-maven-<version>\conf\settings.xml to ~/.m2/settings.xml.

Configure visiativ repository.

<settings>
	...
	<profiles>
		<profile>
			<id>repository.devops.moovapps.com</id>
			<repositories>
			    <repository>
					<id>java-moovapps-public</id>
					<url>https://repository.devops.moovapps.com/repository/java-moovapps-public/</url>
				</repository>
				<repository>
					<id>java-moovapps-private</id>
					<url>https://repository.devops.moovapps.com/repository/java-moovapps-private/</url>
				</repository>
			</repositories>
			
			<pluginRepositories>
				<pluginRepository>
					<id>java-moovapps-private-plugins</id>
					<url>https://repository.devops.moovapps.com/repository/java-moovapps-private/</url>
					<releases>
						<enabled>true</enabled>
					</releases>
					<snapshots>
						<enabled>true</enabled>
					</snapshots>
				</pluginRepository>
			</pluginRepositories>
		</profile>
	</profiles>
	...
	<!-- auto enable the profile -->
	<activeProfiles>
		<activeProfile>repository.devops.moovapps.com</activeProfile>
	</activeProfiles>
	...
</settings>