Apache Maven, is an innovative software project management tool, provides new concept of a project object model (POM) file to manage project’s build, dependency and documentation. The most powerful feature is able to download the project dependency libraries automatically.
Check maven version to see if maven is already installed in your Ubuntu box : mvn -version
Install maven in Ubuntu : sudo apt-get install maven2
Note : If the “version” tag is ignore, it will upgrade the library automatically when there is a newer version.
Include “Maven coordinates” into “pom.xml” file, under “dependency” tag.
maven Command to skipTest, clean and install from cmd prompt :
mvn -DskipTests clean install
Sync Maven Project with Eclipse (Run this command where pom.xml in your java project exists)
Check maven version to see if maven is already installed in your Ubuntu box : mvn -version
Install maven in Ubuntu : sudo apt-get install maven2
Refer for more maven details about local repository, central repository and remote repository : http://www.mkyong.com/tutorials/maven-tutorials/
Maven central repository : http://repo1.maven.org/maven2/
Maven central repository : http://repo1.maven.org/maven2/
Note : If the “version” tag is ignore, it will upgrade the library automatically when there is a newer version.
Include “Maven coordinates” into “pom.xml” file, under “dependency
mvn eclipse:eclipse
You can download jars from maven repository : http://mvnrepository.com/artifact/org.hibernate/hibernate-tools/3.2.0.ga
Install maven manually in linux box
Download maven
You can download jars from maven repository : http://mvnrepository.com/artifact/org.hibernate/hibernate-tools/3.2.0.ga
Install maven manually in linux box
Download maven
- Extract the distribution archive, i.e. apache-maven-3.0.4-bin.tar.gz to the directory you wish to install Maven 3.0.4. These instructions assume you chose /usr/local/apache-maven. The subdirectory apache-maven-3.0.4 will be created from the archive.
- In a command terminal, add the M2_HOME environment variable, e.g. export M2_HOME=/usr/local/apache-maven/apache-maven-3.0.4.
- Add the M2 environment variable, e.g. export M2=$M2_HOME/bin.
- Optional: Add the MAVEN_OPTS environment variable to specify JVM properties, e.g. export MAVEN_OPTS="-Xms256m -Xmx512m". This environment variable can be used to supply extra options to Maven.
- Add M2 environment variable to your path, e.g. export PATH=$M2:$PATH.
- Make sure that JAVA_HOME is set to the location of your JDK, e.g. export JAVA_HOME=/usr/java/jdk1.5.0_02 and that $JAVA_HOME/bin is in your PATH environment variable.
- Run mvn --version to verify that it is correctly installed.
Create a maven project with below command :
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
cd my-app The src/main/java directory contains the project source code, the src/test/java directory contains the test source, and the pom.xml file is the project's Project Object Model, or POM. mvn package package - take the compiled code and package it in its distributable format, such as a JAR.
Execute Below command if you want to open the project in eclipse.
mvn eclipse:eclipse mvn eclipse:clean
If above command not executed you will UnSupported error while you do Import maven project in eclipse.
Install maven plug-in in eclipse Help -> Install Eclipse Market Place -> maven
No comments :
Post a Comment