Difference between revisions of "Maven"

(Created page with "=Manual install= Download last version: http://maven.apache.org/download.html ==Required folders== Put it an easy to access folder: /usr/local/DEV/tools/maven <syntaxhighlig...")
 
Line 1: Line 1:
 +
[[Category:Linux]]
 +
[[Category:Development]]
 +
 +
 
=Manual install=
 
=Manual install=
 +
 
Download last version: http://maven.apache.org/download.html
 
Download last version: http://maven.apache.org/download.html
 +
  
  
 
==Required folders==
 
==Required folders==
 +
 
Put it an easy to access folder: /usr/local/DEV/tools/maven
 
Put it an easy to access folder: /usr/local/DEV/tools/maven
 +
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
mkdir -p /usr/local/DEV/tools
 
mkdir -p /usr/local/DEV/tools
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
  
  
 
==Local repository==
 
==Local repository==
 +
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
mkdir /usr/local/DEV/m2repo
 
mkdir /usr/local/DEV/m2repo
Line 29: Line 39:
  
 
==Environment variable==
 
==Environment variable==
 +
 
You need to add an environment variable:
 
You need to add an environment variable:
 +
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
vim /etc/profile
 
vim /etc/profile
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
  
 
Add:
 
Add:
 +
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
export M2_HOME="/usr/local/DEV/tools/maven"
 
export M2_HOME="/usr/local/DEV/tools/maven"
Line 47: Line 61:
 
export PATH
 
export PATH
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
  
  
 
===Ubuntu specifics===
 
===Ubuntu specifics===
 +
 
Set environment values  
 
Set environment values  
 +
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
vim /etc/environment
 
vim /etc/environment
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
  
 
Add:
 
Add:
 +
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
M2_HOME="/usr/local/DEV/tools/maven"
 
M2_HOME="/usr/local/DEV/tools/maven"
Line 63: Line 82:
  
 
Check new values
 
Check new values
 +
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
source /etc/profile
 
source /etc/profile
Line 70: Line 90:
 
ln -s /usr/local/DEV/tools/maven/bin/mvn  /sbin/mvn
 
ln -s /usr/local/DEV/tools/maven/bin/mvn  /sbin/mvn
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
  
 
Check configuration
 
Check configuration
 +
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
mvn -version
 
mvn -version
 
</syntaxhighlight>
 
</syntaxhighlight>

Revision as of 17:14, 10 June 2014


Manual install

Download last version: http://maven.apache.org/download.html


Required folders

Put it an easy to access folder: /usr/local/DEV/tools/maven

mkdir -p /usr/local/DEV/tools


Local repository

mkdir /usr/local/DEV/m2repo

MAVEN configuration and add local repository Edit: $MAVEN/conf/setting.xml

<!-- Local repository -->
<localRepository>/usr/loca/DEV/m2repo</localRepository>


LINUX configuration

Environment variable

You need to add an environment variable:

vim /etc/profile


Add:

export M2_HOME="/usr/local/DEV/tools/maven"
export M2=$M2_HOME/bin
export M2_REPO="/usr/local/DEV/m2repo"

if [ "`id -u`" -eq 0 ]; then
   PATH="[...]:$JAVA_HOME/bin:$M2"
else
	   PATH="[...]:$JAVA_HOME/bin:$M2"
fi
export PATH


Ubuntu specifics

Set environment values

vim /etc/environment


Add:

M2_HOME="/usr/local/DEV/tools/maven"
M2="$M2_HOME/bin"
M2_REPO="/usr/local/DEV/m2repo"

Check new values

source /etc/profile

Add exec symlink
<syntaxhighlight lang="bash">
ln -s /usr/local/DEV/tools/maven/bin/mvn  /sbin/mvn


Check configuration

mvn -version