Maven,技术帖,版本控制与代码管理 2018-03-05

  • Welcome

Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.

  • Download 3.3+ require JDK 1.7 or above to execute)

  • Installation

1.tar xzvf apache-maven-3.5.2-bin.tar.gz

  1. Add the bin directory of the created directory apache-maven-3.5.2 to the PATH environment variable
  2. Confirm with mvn -v in a new shell.
  • Run

1.The syntax for running Maven is as follows:

mvn  -options -goals -phases

2.Help references:

mvn  -h

3.The typical invocation for building a Maven Project uses a Maven life cycle phase E.g:

mvn package
  • clean: pre-clean=>clean=>post-clean
  • default: validate=>initialize=>generate-sources=>process-sources=>generate-resources=> process-resources=>compile=>process-classes=>generate-test-sources=> process-test-sources=>generate-test-resources=>process-test-resources=>test-compile=>process-test-classes=>test=>prepare-package=> package=> pre-integration-test=> integration-test=>post-integration-test=>verify =>install=> deploy
  • site: pre-site=>site=>post-site=>site-deploy

4.A fresh build of a project generating all packaged outputs and the documentation site and deploying it to a repository manager could be done with:

mvn clean deploy site-deploy

5.Just creating the package and installing it in the local repository for re-use from other projects can be done with:

mvn verify
  • IDE Integration

1.M2Eclipse is the official Eclipse project for Maven integration for the Eclipse IDE.

2.Intelli IDEA has a feature-rich integration for Maven.

3.NetBeans includes full Maven support since 6.7, including Maven 3 support in 7.0+.

  • Maven Release History

2017-10-24 Version3.5.2 Java 7

2014-12-20 Version3.2.5 Java 6 2014-02-18 End of Life (Maven2、Maven1)

2013-10-04 Version3.1.1 Java 5 2009-11-08 Version2.2.1 Java 5

  • Create own directory structure

By configuring , and other elements of the section.

Put the jar into local repository

If you understand the layout of the Maven repository, you can copy the jar directly into where it is meant to go. Maven will find this file next time it is run.

If you are not confident about the layout of the Maven repository, then you can adapt the following command to load in your jar file, all on one line.

  1. mvn install:install-file
  2. -Dfile=<path-to-file>
  3. -DgroupId=<group-id>
  4. -DartifactId=<artifact-id>
  5. -Dversion=
  6. -Dpackaging=
  7. -DgeneratePom=true
  8. Where: <path-to-file> the path to the file to load
    9.<group-id> the group that the file should be registered under
    10.<artifact-id> the artifact name for the file
    11. the version of the file
    12. the packaging of the file e.g. jar
  • MOJO??

A mojo is a Maven plain Old Java Object. Each mojo is an executable goal in Maven, and a Maven plugin is a distribution of one or more related mojos.

  • Maven In 5 minutes

本文由 BF 创作,采用 知识共享署名 3.0,可自由转载、引用,但需署名作者且注明文章出处。



bst g22 jinniu lilai opebet orange88 vinbet xbet yuebo zunlong shijiebei bet007 hg0088 ju111 letiantang m88 mayaba qg777 qianyiguoji sbf777 tengbohui tlc ule weilianxier waiweitouzhu xingfayule xinhaotiandi yinheyule youfayule zhongying 2018shijiebei w88 18luck 188bet beplay manbet 12bet 95zz shenbo weide1946 ca88 88bifa aomenxinpujing betway bodog bt365 bwin tongbao vwin weinisiren 88jt fenghuangyule hongyunguoji 918botiantang huanyayule jianada28 jixiangfang libo long8 hongzuyishi zuqiutouzhu