Maven3.5.0 Installation and Configuration

Source: Internet
Author: User

Maven3.5.0 Installation and configuration download Maven3.5.0
Maven3.5.0 Download address Maven3.5.0 installation
Unzip the downloaded, such as "g:\java\ maven\apache-maven-3.5.0 "Under, try not to install to" C:\ "under, lest all sorts of strange problems occur.
Configure environment variables:
Add in Path:%maven_home%\bin
Test installation was successful and executed under CMD:
Mvn-version or Mvn-v, which indicates that the installation and configuration environment variable succeeded:
Configure MAVEN
Open the MAVEN installation directory \conf\settings.xml file
Add the local warehouse address under settings, such as "G:/java/maven/maven-dependcies" below:

<settings xmlns= ""
          xmlns:xsi= " Xmlschema-instance "
          xsi:schemalocation=" Settings-1.0.0.xsd ">
   | The path to the local repository maven would use to store artifacts.
   | Default: ${user.home}/.m2/repository

Add under "Profiles" configuration:

<profile> <profile> <id>jdk-1.8</id> <activation> <activeby default>true</activebydefault> <jdk>1.8</jdk> </activation> <propert Ies> <maven.compiler.source>1.8</maven.compiler.source> <>1.8&
    Lt;/> <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion> </properties> </profile> </profile> <!--> < repositories> <repository> <id>Ibiblio</id> <name>    
        Ibiblio</name> <url></url> </repository> <repository> <id>PlanetMirror</id> <name>planet Mirr     
   Or</name>         <url></url> </repository> </reposit Ories>


Saves the settings.xml file.
4. Initialize
mvn help:system

appears under cmd "Build SUCCESS" means initialization is successful, "Maven-dependcies" appears under the MAVEN installation directory, This is the warehouse directory that we have configured above.
5. Open the Eclipse–window–perferences–maven–installations and click the "Add" button to add the Maven path:

6. eclipse–window– Perferences–maven–user settings, setting the profile path:

7. Create a new Maven project in Eclipse, "New–other–maven project", set the engineering path, select WebApp, The following figure:

8. Add "Servlet-api.jar" to the new project, the jar file is in the Tomcat\lib directory.
9. Open the "pom.xml" file in the new project, add

<project xmlns= "" xmlns:xsi= "Http://" xsi: schemalocation= "" > <modelversion
  >4.0.0</modelVersion> <groupId>cn.xaele</groupId> <artifactId>kq</artifactId> <packaging>war</packaging> <version>0.0.1-SNAPSHOT</version> &LT;NAME&GT;KQ Maven Webapp </name> <url></url> <properties> < Gt Utf-8</> <encoding>UTF-8</encoding> <java.version>1.8</ Java.version> <maven.compiler.source>1.8</maven.compiler.source> <>1.8 </> </properties> <dependencies> <dependency> <groupid>j Unit</groupid> <artifactId>junit</artifactid> <version>3.8.1</version> <scope>test</scope> </dependency> <!----> <dependency> <groupId>org.springframework</groupId> <artifact

    Id>spring-context</artifactid> <version>4.3.9.RELEASE</version> </dependency>
    <!--all kinds of jar packages required for--> ... </dependencies> <build> <finalName>kq</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artif Actid>maven-compiler-plugin</artifactid> <version>3.6.1</version> &LT;CONFIGURATION&G
          T <source>1.8</source> <target>1.8</target> &LT;ENCODING&GT;UTF-8&LT;/ENCODING&G
        T </configuration> </plugin> </plugins> </build> </project>
Right-click on the new Project –maven–update project ..., when finished, right-click –run As–maven Install package, you can see the generated war file in the "target" directory under the engineering directory. Other matters:

After Maven clear, a compile error occurs directly to the MAVEN build, and you can do so regardless of the eclipse–project–clear.

MAVEN installs the local Jar Pack command:
MVN Install:install-file-dfile=jar Package Position-dgroupid= Upper groupid-dartifactid= above artifactid-dversion= above version- Dpackaging=jar

Examples are as follows:

MVN Install:install-file-dfile=d:\commbean1.0.1.jar-dgroupid=cn.xaele-dartifactid=comm-dversion=1.0.1.release- Dpackaging=jar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.