Java Project Management maven2.0 Learning notes

Source: Internet
Author: User
Tags java web
Paste : Http://blog.csdn.net/shiqiang1234/archive/2006/10/12/1331725.aspx Maven Introduction

The original purpose of MAVEN was to simplify the build process in the Jakarta turbine project. The ant build files used between several projects differ very little, and each jar is stored in CVS. So hopefully there is a standard way to build each project, clearly define the composition of a project, an easy way to publish project information and to provide a shared jar package between projects.

As a result, there is a feature that can be used to build and manage any java-based project. The MAVEN team wants them to do something that will help Java developers make it easier to do their daily work and help understand any java-based project.

The goal of Maven is to:

Make the build process easier

Provide a unified build system

Provide high quality project information

Provide a best practice guide for development

The ability to seamlessly add new features

The wrong understanding of Maven

MAVEN is a site and document making tool.

Maven extends ant so that it can be downloaded to a variety of dependency packs

MAVEN is a series of reusable ant scripts

The version of Maven.

Maven now mainly has maven 1.x and Maven 2.x, where the latest version is Maven 2.02.

Maven 2 completes the rewrite of Maven 1. The overriding purpose of the rewrite is to provide a powerful jave build and a project that contains APIs that allow Maven to be implanted anywhere, especially high-level products such as Ides, quality tools, reporting tools, and so on. The concept of the Maven 2 build lifecycle is formalized and is easier to scale than maven.

So now our main research is maven 2. installation of Maven

Windows 2000/xp the installation under

Unzip maven-2.0.2-bin.zip to the directory where you want to install Maven 2.0.2. This assumes that you have chosen C:/programfiles/apache Software foundation/maven-2.0.2.

Add the C:/Program files/apache Software foundation/maven-2.0.2/bin directory to your%path% environment variable.

Also, verify that the Java_home is set correctly.

Run MVN--version confirm that the installation is successful.

Displaying Maven version:2.0.2 indicates that the installation was successful.

based on Unxi -- based the operating system ( Linux , Solaris and Mac OS X )

Unzip the release package to the directory where you want to install Maven 2.0.2. Here, suppose you chose/usr/local/maven-.

Add the/usr/local/maven-2.0.2/bin directory to your PATH environment variable, for example: Path=/usr/local/maven-2.0.2y/bin: $PATH.

Also, verify that the Java_home is set correctly.

Run MVN--version confirm that the installation is successful.

Displaying Maven version:2.0.2 indicates that the installation was successful. Maven Main Features list

MAVEN is a project management tool that provides a way to manage the work involved in the following projects, and the following are the main features of Maven:

Build project (builds)

Document Preparation (documentation)

Report (Reporting)

Dependency Management (dependencies)

Configuration Management (SCMs)

Release Management (releases) build project

first create a Maven Engineering

Maven can be used to build Java application Engineering and Java Web application engineering.

WebApp

MVN Archetype:create-dgroupid=com.mycompany.app-dartifactid=my-webapp

-darchetypeartifactid=maven-archetype-webapp

My-webapp

|--Pom.xml

'--src

'--Main

|--WebApp

| | | |-Web-inf

| | '--Web.xml

| '--index.jsp

'--Resources

Other catalogs need to be supplemented by themselves.

The contents of its Pom.xml document are as follows:

<project xmlns= "http://maven.apache.org/POM/4.0.0" xmlns:xsi= "http://www.w3.org/2001/ Xmlschema-instance"xsi:schemalocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/ Maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>Com.mycompany.app</groupId>

<artifactId>My-webapp</artifactId>

<packaging>War</packaging>

<version>1.0-snapshot</version>

<name>Maven Webapp archetype</name>

<url>http://maven.apache.org</url>

<dependencies>

<dependency>

<groupId>JUnit</groupId>

<artifactId>JUnit</artifactId>

<version>3.8.1</version>

<scope>Test</scope>

</dependency>

</dependencies>

<build>

<finalName>My-webapp</finalName>

</build>

</project>



App

MVN Archetype:create-dgroupid=com.mycompany.ap-dartifactid=my-app

After the command executes correctly, the following directory is generated:

My-app

|--Pom.xml

'--src

|--Main

| '--Java

| '--com

| '--MyCompany

| '--app

| '--App.java

'--Test

'--Java

'--com

'--MyCompany

'--app

'--Apptest.java

The contents of its Pom.xml document are as follows:

<project xmlns= " http://maven.apache.org/POM/4.0.0 " xmlns:xsi= " http://www.w3.org/2001/xmlschema-instance "xsi:schemalocation=" http://maven.apache.org/ pom/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd >

  <modelversion> 4.0.0 </modelVersion>

  <groupid> Com.mycompany.ap </groupId>

  <artifactid> My-app </artifactid

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: info-contact@alibabacloud.com 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.