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...")
 
 
(2 intermediate revisions by the same user not shown)
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 18: Line 28:
 
Edit: $MAVEN/conf/setting.xml
 
Edit: $MAVEN/conf/setting.xml
  
<syntaxhighlight lang="bash">
+
<syntaxhighlight lang="xml">
 
<!-- Local repository -->
 
<!-- Local repository -->
 
<localRepository>/usr/loca/DEV/m2repo</localRepository>
 
<localRepository>/usr/loca/DEV/m2repo</localRepository>
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 61: Line 80:
 
M2_REPO="/usr/local/DEV/m2repo"
 
M2_REPO="/usr/local/DEV/m2repo"
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
  
 
Check new values
 
Check new values
 +
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
source /etc/profile
 
source /etc/profile
 +
</syntaxhighlight>
 +
  
 
Add exec symlink
 
Add exec symlink
 +
 
<syntaxhighlight lang="bash">
 
<syntaxhighlight lang="bash">
 
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>

Latest revision as of 09:31, 10 September 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

ln -s /usr/local/DEV/tools/maven/bin/mvn  /sbin/mvn


Check configuration

mvn -version