Maven - Install (Local Package Installation)

Card Puncher Data Processing

About

Install is a phase that install the generated artifact in the local repository.

Installation in a remote location is called: deploy

Plugin

Plugin that can be used in this phase.

Apache Maven Install

Install: Install the main artifact and the derived one

install is a goal that will install:

  • the project's main artifact
  • and any other artifacts attached by other plugins in the lifecycle such as an assembly artifact.

Install-file: Install an external file in a local repository manually

Installs a file in the local repository if it's available in any public remote repository.

This installation occurs in the local maven repository, see remote repository for an installation on a server.

Example:

cd $ORACLE_HOME/jdbc/lib
mvn install:install-file -Dfile=ojdbc6.jar -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2.0.2.0 -Dpackaging=jar -DgeneratePom=true
  • Microsoft JDBC driver
mvn install:install-file -Dfile="/path/to/sqljdbc41.jar" -DgroupId=com.microsoft -DartifactId=jdbc -Dversion=4.1 -Dpackaging=jar

where:

Maven Resource Plugin

Copy-resources: Copy into a local directory

<plugin>
	<artifactId>maven-resources-plugin</artifactId>
	<version>3.0.0</version>
	<executions>
		<execution>
			<id>deploy-to-local-directory</id>
			<phase>install</phase>
			<goals>
				<goal>copy-resources</goal>
			</goals>
			<configuration>
				<outputDirectory>/my/local/path</outputDirectory>
				<resources>
					<resource>
						<directory>${project.build.directory}</directory>
						<includes>
							<include>${project.build.finalName}.jar</include>
						</includes>
						<filtering>false</filtering>
					</resource>
				</resources>
			</configuration>
		</execution>
	</executions>
</plugin>

Dependency Plugin

Unpack (Unzip)

This goal permits to unzip locally a created assembly (generally in a local bin directory.

<plugin>
	<artifactId>maven-dependency-plugin</artifactId>
	<executions>
		<execution>
			<id>unzip-windows-x64</id>
			<phase>install</phase>
			<goals>
				<goal>unpack</goal>
			</goals>
			<configuration>
				<outputDirectory>
					/output/local/bin
				</outputDirectory>
				<artifactItems>
					<artifactItem>
						<groupId>${project.groupId}</groupId>
						<artifactId>${project.artifactId}</artifactId>
						<version>${project.version}</version>
						<classifier>windows-x64</classifier>
						<type>zip</type>
					</artifactItem>
				</artifactItems>
			</configuration>
		</execution>
	</executions>
</plugin>

Documentation / Reference





Discover More
Card Puncher Data Processing
Maven - (Deploy|Distribution) Phase

This deploy phase copies: a (final) package a web site or the Javadoc documentation to a remote repository for sharing with other developers and projects. In most project builds, the deploy phase...
Idea Maven Dependency Tree
Maven - Dependency

dependency management in Maven. Dependency are artifact where your software depends on. Dependency are defined in the pom.xml, section dependencies. When you build an application, Maven will search...
Card Puncher Data Processing
Maven - Lifecycle

A Build Lifecycle is Made Up of Phases. To call all phase, you only need to call the last build phase to be executed, deploy: If you call a build phase, it will execute not only that build phase, but...
Card Puncher Data Processing
Maven - Local Repository

A local repository is the repository of the local file system of Maven. The default value is /.m2/repository/ Value Example Os /.m2 ~/.m2 Linux/Unix/Mac OS X C:\Windows\System32\config\systemprofile\.m2...
Card Puncher Data Processing
Maven - Phase (Build lifecycle)

A phase is a step in the build lifecycle, which is an ordered sequence of phases. When a phase is given, Maven will execute every phase in the sequence up to and including the one defined. Phases are...
Card Puncher Data Processing
Maven - Plugin Development

How to develop a maven plugin with Java Annotation. (It's important for the configuration). The code result of this tutorial is on github. gerardnico/helloworld-maven-pluginhelloworld-maven-plugin ...



Share this page:
Follow us:
Task Runner