Maven to create Java projects and Web projects

Source: Internet
Author: User

  1. Create a Java Project

    C:\USERS\ADMINISTRATOR\DESKTOP>MVN Archetype:generate-dgroupid=yxyu.xx-dartifa

    Ctid=xx1-darchetypeartifactid=maven-archetype-quickstart-dinteractivemode=fals

    E

  2. Create a Web project

C:\USERS\ADMINISTRATOR\DESKTOP>MVN archetype:generate-dgroupid=yxyu.web-dartif

Actid=testwebapp-darchetypeartifactid=maven-archetype-webapp-dinteractivmode=f

Alse

[INFO] Scanning for projects ...

[INFO]

[INFO]------------------------------------------------------------------------

[INFO] Building Maven Stub Project (No POM) 1

[INFO]------------------------------------------------------------------------

[INFO]

[INFO] >>> maven-archetype-plugin:2.3:generate (DEFAULT-CLI) > Generate-sources

@ standalone-pom >>>

[INFO]

[INFO] <<< maven-archetype-plugin:2.3:generate (DEFAULT-CLI) < generate-sources

@ standalone-pom <<<

[INFO]

[INFO]---maven-archetype-plugin:2.3:generate (default-cli) @ standalone-pom--

-

[INFO] Generating project in Interactive mode

[INFO] Using property:groupid = Yxyu.web

[INFO] Using Property:artifactid = Testwebapp

Define value for property ' version ': 1.0-snapshot::

[INFO] Using property:package = Yxyu.web

Confirm Properties Configuration:

GroupId:yxyu.web

Artifactid:testwebapp

Version:1.0-snapshot

Package:yxyu.web

Y:: Y

[INFO]-------------------------------------------------------------------------

---

[INFO] Using following parameters for creating project from the old (1.x) archetype:

maven-archetype-webapp:1.0

[INFO]-------------------------------------------------------------------------

---

[INFO] Parameter:groupid, Value:yxyu.web

[INFO] Parameter:packagename, Value:yxyu.web

[INFO] Parameter:package, Value:yxyu.web

[INFO] Parameter:artifactid, Value:testwebapp

[INFO] Parameter:basedir, Value:c:\users\administrator\desktop

[INFO] Parameter:version, Value:1.0-snapshot

[INFO] project created from old (1.x) archetype in dir:c:\users\administrator\d

Esktop\testwebapp

[INFO]------------------------------------------------------------------------

[INFO] BUILD SUCCESS

[INFO]------------------------------------------------------------------------

[INFO] Total time:02:07 min

[INFO] Finished at:2015-06-26t13:54:37+08:00

[INFO] Final memory:11m/26m

[INFO]------------------------------------------------------------------------


C:\USERS\ADMINISTRATOR\DESKTOP>CD Testwebapp


C:\USERS\ADMINISTRATOR\DESKTOP\TESTWEBAPP>MVN Compile

[INFO] Scanning for projects ...

[INFO]

[INFO]------------------------------------------------------------------------

[INFO] Building Testwebapp Maven Webapp 1.0-snapshot

[INFO]------------------------------------------------------------------------

[INFO]

[INFO]---maven-resources-plugin:2.6:resources (default-resources) @ Testwebapp

---

[WARNING] Using platform Encoding (GBK actually) to copy filtered resources, i.e

. Build is Platform dependent!

[INFO] Copying 0 Resource

[INFO]

[INFO]---maven-compiler-plugin:3.1:compile (default-compile) @ Testwebapp---

[INFO] No sources to compile

[INFO]------------------------------------------------------------------------

[INFO] BUILD SUCCESS

[INFO]------------------------------------------------------------------------

[INFO] Total time:1.523 S

[INFO] Finished at:2015-06-26t13:54:58+08:00

[INFO] Final memory:6m/16m

[INFO]------------------------------------------------------------------------

3. "Turn" a person's things:

------------------------------Maven3 Common commands--------- ------------------

1. Common commands

1) Create a project

MVN archetype:generate-dgroupid=com.mycompany.app-dartifactid=my-app-darchetypeartifactid= Maven-archetype-quickstart-dinteractivemode=false

MVN archetype:generate Fixed format

-dgroupid Organization identification (package name)

-dartifactid Project Name

-darchetypeartifactid Specify archetypeid,maven-archetype-quickstart, create a Java Project ; Maven-archetype-webapp, create a web Project

-dinteractivemode whether to use interactive mode

2) compiling the source code

MVN Compile

3) Compile the test code

MVN Test-compile

4) Clear

MVN clean

5) Run the test

MVN test

6) Production Site Directory and packaging

MVN Site-deploy

7) Install the current project's output file to the local repository

MVN Install

8) Packaging

MVN Package

9) First clear and then pack

MVN Clean Package

10) hit into a jar package

MVN Jar:jar

11) Build Eclipse Project

MVN Eclipse:eclipse

12) View Help information

MVN help:help

13) See what Project type categories maven has

MVN archetype:generate-darchetypecatalog=intrenal

 2. The standard MAVEN project structure

                    

Src/main/java storing the source code of the project

Src/test/java Store Test Source code

If you want to store some configuration files, you can set up a directory Src/main/resource storage, such as storage log4j.properties, etc.


Maven to create Java projects and Web projects

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.