Maven : Apache Maven is a basically used for managing project's build, reporting and documentation. Maven is based on model which is called POM(Project Object Model).
Installation :
1. Download Maven from http://maven.apache.org/download.html eg.version Maven 3.0.4
2. unzip into any Directory. ex. C:\Program Files\apache-maven-3.0.4(Windows) or /usr/local/apache-maven/apache-maven-3.0.4(Unix)
3. Add Environment variable M2_HOME = <Installation dir without bin directory> or export M2_HOME = <path of installed without bin>
4. append %M2_HOME%\bin into PATH Environment
Unix : export M2=$M2_HOME/bin and export PATH=$M2:$PATH
6. Optional – add the environment variable MAVEN_OPTS to specify JVM properties, e.g.
Windows : MAVEN_OPTS = -Xms256m -Xmx512m
Unix : export MAVEN_OPTS=”-Xms256m -Xmx512m”
5. goto cmd and check Maven as : mvn -version
Configuring Maven :
Maven will run with sensible defaults, so you can get right into it. However, if you are operating under a restricted environment or
behind a firewall, you might need to prepare to run Maven, as it requires write access to the home directory (~/.m2 on Unix/Mac OS X
and C:\Documents and Settings\username\.m2 on Windows) and network access to download binary dependencies.
http://maven.apache.org/guides/mini/guide-configuring-maven.html
maven.apache.org/guides/mini/guide-proxies.html
Building Project :
The vast majority of Maven-built projects can be built with the following command:
mvn clean install
This command tells Maven to build all the modules, and to install it in the local repository.
Configuring your Local Repository :
The location of your local repository can be changed in your user configuration. The default value is ${user.home}/.m2/repository/.
<settings>
…
<localRepository>/path/to/local/repo/</localRepository>
…
</settings>
Configuring Parallel Artifact Resolution :
By default, Maven 2.1.0+ will download up to 5 artifacts (from different groups) at once. To change the size of the thread pool,
start Maven using -Dmaven.artifact.threads. For example, to only download single artifacts at a time:
mvn -Dmaven.artifact.threads=1 clean install
You may wish to set this option permanently, in which case you can use the MAVEN_OPTS environment variable. For example:
export MAVEN_OPTS=-Dmaven.artifact.threads=3
Security and Deployment Settings
Repositories to deploy to are defined in a project in the <distributionManagement> section. However, you cannot put your username, password, or other security settings in that project. For that reason, you should add a server definition to your own settings with an id that matches that of the deployment repository in the project.
In addition, some repositories may require authorization to download from, so the corresponding settings can be specified in a server element in the same way.
Which settings are required will depend on the type of repository you are deploying to. As of the first release, only SCP deployments and file deployments are supported by default, so only the following SCP configuration is needed:
<settings>
…
<servers>
<server>
<id>repo1</id>
<username>repouser</username>
<!– other optional elements:
<password>my_login_password</password>
<privateKey>/path/to/identity</privateKey> (default is ~/.ssh/id_dsa)
<passphrase>my_key_passphrase</passphrase>
–>
</server>
…
</servers>
…
</settings>
Links :
http://maven.apache.org/guides/getting-started/index.html
http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
Installation :
1. Download Maven from http://maven.apache.org/download.html eg.version Maven 3.0.4
2. unzip into any Directory. ex. C:\Program Files\apache-maven-3.0.4(Windows) or /usr/local/apache-maven/apache-maven-3.0.4(Unix)
3. Add Environment variable M2_HOME = <Installation dir without bin directory> or export M2_HOME = <path of installed without bin>
4. append %M2_HOME%\bin into PATH Environment
Unix : export M2=$M2_HOME/bin and export PATH=$M2:$PATH
6. Optional – add the environment variable MAVEN_OPTS to specify JVM properties, e.g.
Windows : MAVEN_OPTS = -Xms256m -Xmx512m
Unix : export MAVEN_OPTS=”-Xms256m -Xmx512m”
5. goto cmd and check Maven as : mvn -version
Configuring Maven :
Maven will run with sensible defaults, so you can get right into it. However, if you are operating under a restricted environment or
behind a firewall, you might need to prepare to run Maven, as it requires write access to the home directory (~/.m2 on Unix/Mac OS X
and C:\Documents and Settings\username\.m2 on Windows) and network access to download binary dependencies.
http://maven.apache.org/guides/mini/guide-configuring-maven.html
maven.apache.org/guides/mini/guide-proxies.html
Building Project :
The vast majority of Maven-built projects can be built with the following command:
mvn clean install
This command tells Maven to build all the modules, and to install it in the local repository.
Configuring your Local Repository :
The location of your local repository can be changed in your user configuration. The default value is ${user.home}/.m2/repository/.
<settings>
…
<localRepository>/path/to/local/repo/</localRepository>
…
</settings>
Configuring Parallel Artifact Resolution :
By default, Maven 2.1.0+ will download up to 5 artifacts (from different groups) at once. To change the size of the thread pool,
start Maven using -Dmaven.artifact.threads. For example, to only download single artifacts at a time:
mvn -Dmaven.artifact.threads=1 clean install
You may wish to set this option permanently, in which case you can use the MAVEN_OPTS environment variable. For example:
export MAVEN_OPTS=-Dmaven.artifact.threads=3
Security and Deployment Settings
Repositories to deploy to are defined in a project in the <distributionManagement> section. However, you cannot put your username, password, or other security settings in that project. For that reason, you should add a server definition to your own settings with an id that matches that of the deployment repository in the project.
In addition, some repositories may require authorization to download from, so the corresponding settings can be specified in a server element in the same way.
Which settings are required will depend on the type of repository you are deploying to. As of the first release, only SCP deployments and file deployments are supported by default, so only the following SCP configuration is needed:
<settings>
…
<servers>
<server>
<id>repo1</id>
<username>repouser</username>
<!– other optional elements:
<password>my_login_password</password>
<privateKey>/path/to/identity</privateKey> (default is ~/.ssh/id_dsa)
<passphrase>my_key_passphrase</passphrase>
–>
</server>
…
</servers>
…
</settings>
Links :
http://maven.apache.org/guides/getting-started/index.html
http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
No comments:
Post a Comment