Maven
Table of Contents
Installing
- Dowload maven 3.3.9 from http://archive.apache.org/dist/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.zip
- Unzip it on a folder of your preference
- Set environment variables.
- Linux
- Put it at your
$HOME/.profilefileexport M2_HOME=/path/to/where/you/extracted/maven/apache-maven-3.3.9 export PATH=$M2_HOME/bin:$PATH export MAVEN_OPTS='-Xmx1024m -XX:MaxPermSize=256m' - If you already have java set up, your
.profile, it should look like this:export JAVA_HOME=/your/jdk/parent/folder/java export M2_HOME=/path/to/where/you/extracted/maven/apache-maven-3.3.9 export PATH=$JAVA_HOME/bin:$M2_HOME/bin:$PATH export MAVEN_OPTS='-Xmx1024m' - Logout and login again.
- Test by opening a terminal and typing:
mvn -version - The result should be similar to:
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0 Apache Maven 3.3.1 (cab6659f9874fa96462afef40fcf6bc033d58c1c; 2015-03-13T17:10:27-03:00) Maven home: /home/riss/apps/maven Java version: 1.8.0_45, vendor: Oracle Corporation Java home: /home/riss/apps/jdk1.8.0_45/jre Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "3.13.0-55-generic", arch: "amd64", family: "unix"
- Put it at your
- Windows
- Open Control Panel go to System, Advanced system settings, Environment Variables button.
- At the System Variables section, click New.
- Set
M2_HOMEand point to the root of maven folder. - Search for the variable
Pathin the list, click on it and press Edit. - Put the maven bin folder right after java home:
%JAVA_HOME%\bin;%M2_HOME%\bin; - Set the variable MAVEN_OPTS.
MAVEN_OPTS=-Xmx1024m - The result should be similar to:
Apache Maven 3.3.9 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 12:22:22-0300) Maven home: C:\data\apache-maven-3.3.9 Java version: 1.8.0_45, vendor: Oracle Corporation Java home: C:\Program Files\Java\jdk1.8.0_45\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows 8.1", version: "6.3", arch: "amd64", family: "dos"
- Linux
Configuring
Copying settings.xml
- If you already have executed a full checkout, get the file at
production/global-settinsg.xmlin you working copy and copy toM2_HOME/conf. If you have not executed a full checkout, get a copy of global settings here. - Rename the file
settings.xmlalready located atM2_HOME/conftosettings.old.xml. - Rename the previously copied
global-settings.xmlatM2_HOME/conftosettings.xml. - If you already have executed a full checkout, get the file at
production/infrastructure/toos/user-settinsg.xmlin you working copy and copy to$HOME/.m2at linux orC:\Users\YOUR_USER\.m2at windows. If folder.m2does not exist at that destination, please create the folder. If you have not executed a full checkout, get a copy of user settings here. - Rename the file
settings.xmlalready located at.m2folder, if there already is one, tosettings.old.xml. - Rename the previously copied
user-settings.xmlat.m2folder tosettings.xml.
Configuring Proxy
The proxy for maven connections doesn't really need to be configured, since it should be present at M2_HOME/conf/settings.xml. You just need to open this file and check if the proxy address is set
Running
If you already have executed a full checkout:
- Start tomcat.
- Open a command prompt and go to the
productionfolder.- If desired, this can be run only for a particular product. In this case You need to go to production/products/YOUR_PRODUCT.
- If only 1 product was checked out using subversion, then you run the maven command at the root of the checkouted project.
- Type:
mvn -DskipTests clean install - The build will take some time and during the first time you run, maven will take some time to download all dependencies to the folder
YOUR_HOME/.m2/repository, where YOUR_HOME is$HOMEfor linux orC:\Users\YOUR_USERat windows. This will be executed only at the first time and subsequent execution will not require download again. - Wait till maven finish will a SUCCESSFUL BUILD message.
If you did not execute the full checkout, you will need to bookmark this section and back to it after you checkout using eclipse subclipse plugin.
