Maven command and Pom file constants

Source: Internet
Author: User
Tags java web atlassian jira

End Bowl blowing water

Maven command: Maven can be used not only on eclipse, but also in CMD, although it is cumbersome and generally not used, but it is necessary to understand some of the possible ways to do it. 1.MVN compile command: This command is used to compile the project, use this command to compile the code in CMD, the need to first CD into the project directory, or will be error. Using the command to compile the project, the project folder can be "Learn Java, to the Kay Academy kaige123.com" to create their own manual, this manually created style and the style created by Eclipse, the project folder is the main and test folder and the Pom configuration file, The information in this POM file has to be configured, and basic maven is identified around this file, and the main and test files are engineering code and testing code, for example, I create a MavenTest2 project:

Start compiling after you have created the project according to the rules:

The above is the compiled code for compiling successful feedback information:

2.MVN test-compile Command: This command is used to test the project code in the compilation, the test needs to rely on the JUnit package, so also to configure the Pom file, the dependency is written, the package can be found in the Central class library, and then need to create the SRC folder and then the main, The test folder is put in:

Note: You will need to run the MVN compile command to download the dependent JUnit package before you test the compilation, or you will get an error:

Then run the MVN test-compile command:

To test the compiled code:

3.MVN Test command: This command is used to invoke the test and compile the project code

The code test is primarily testing, verifying that the logical results of the code are problematic, and releasing the project if there is no problem.

4.MVN Package Command: This command packages the project and carries out a test when it is packaged:

The package will be placed under this folder:

5.MVN jar:jar Command: This command only hits the jar package, the same good jar package will be placed in the target folder:

6.MVN Clean command: This command cleans up the project file

7.MVN archetype:generate Command: This command creates a project using Maven's template skeleton, which requires you to create a project folder and then CD into that folder to execute the command. To use this command to create a project, you need to download the appropriate package, so wait for a moment:

Then you will be asked to select a number or apply a filter, enter 1:

Then enter the project-related information:

Create success:

The above is a Web project, we need to create a javase project to enter 15 in the selection of numbers, this number represents the Javase engineering skeleton:

The same information needs to be entered in this section:

Create success:

Engineering code that comes with the project skeleton:

The following are the number of engineering skeletons in Maven: 1:internal-APPFUSE-BASIC-JSF (creating a prototype for a hibernate,spring and JSF-based Web application) 2:internal Appfuse-basic-spring (Creating a prototype of a Web application based on hibernate,spring and spring MVC) 3:internal-appfuse-basic-struts ( Create a prototype of a Web application based on hibernate,spring and Struts 2) 4:internal, Appfuse-basic-tapestry (creating a Hibernate-based, Spring, and Tapestry 4 Web application prototype) 5:internal, Appfuse-core (creating a prototype of a jar application based on Hibernate and Spring and Xfire) 6:internal a PPFUSE-MODULAR-JSF (Creating a modular application prototype based on Hibernate,spring and JSF) 7:internal-appfuse-modular-spring (creating a Hibernate-based, Modular application prototypes for spring and spring MVC) 8:internal-appfuse-modular-struts (creating a modular application prototype based on Hibernate, spring, and Struts 2) 9:i Nternal-Appfuse-modular-tapestry (creating a modular application prototype based on Hibernate, Spring and Tapestry 4) 10:internal-Maven-archetype -j2ee-simple (A simple Java application for EE) 11:internal-Maven-archetype-marmalade-mojo (a MAVEN plug-in development project using marmalade) 12 : Internal-Maven-archetype-mojo (a maven Java plug-in development project) 13:INternal-Maven-archetype-portlet (a simple portlet application) 14:internal-maven-archetype-profiles () 15:internal-&gt ; Maven-archetype-quickstart () 16:internal-maven-archetype-site-simple (simple website build project) 17:internal Maven-archetype-site (more complex web site project) 18:internal-Maven-archetype-webapp (A simple Java Web application) 19:internal-Jini-ser Vice-archetype (Archetype for Jini Service Project creation) 20:internal, Softeu-archetype-seam (Jsf+facelets+seam A Rchetype) 21:internal-Softeu-archetype-seam-simple (Jsf+facelets+seam (no residue) prototype) 22:internal-Softeu-archetyp E-JSF (jsf+facelets prototype) 23:internal-Jpa-maven-archetype (JPA application) 24:internal-Spring-osgi-bundle-archetype (Spring-osgi prototype) 25:internal, Confluence-plugin-archetype (Atlassian aggregation plug-in prototype) 26:internal-jira-plugin-archety PE (Atlassian JIRA plug-in prototype) 27:internal-Maven-archetype-har (Hibernate archive) 28:internal, Maven-archetype-sar (jbo SS Service Archive) 29:internal-Wicket-archeType-quickstart (a simple Apache wicket project) 30:internal-Scala-archetype-simple (a simple Scala project) 31:internal-Lift -archetype-blank (a blank/empty liftweb project) 32:internal-Lift-archetype-basic (Basic (Liftweb) project) 33:internal-CO Coon-22-archetype-block-plain ([http://cocoapacorg2/maven-plugins/]) 34:internal-Cocoon-22-archetype-block ([ http://cocoapacorg2/maven-plugins/]) 35:internal-Cocoon-22-archetype-webapp ([http://cocoapacorg2/ maven-plugins/]) 36:internal-Myfaces-archetype-helloworld (a simple prototype using myfaces) 37:internal Myfaces-archetype-helloworld-facelets (a simple prototype using myfaces and Facelets) 38:internal, Myfaces-archetype-trinidad ( A simple prototype using myfaces and Trinidad) 39:internal-Myfaces-archetype-jsfcomponents (a simple prototype that uses Myfaces to create custom JSF components) 40: Internal-gmaven-archetype-basic (Groovy's basic prototype) 41:internal-Gmaven-archetype-mojo (Groovy Mojo prototype)

So entering what number will create the corresponding engineering skeleton. If you need to create the simplest Java project, you need to write a specific skeleton name, so select the skeleton of the step can use the number can also "learn Java, to the Kaige123.com school" use the name of the skeleton, I found that the number of ways to select the skeleton can not create a simple Java project, To use the name of the skeleton:

Create success:

Engineering code that comes with the project skeleton:

Once created, you can use MVN compile to compile, and of course other commands to test what can be used:

8.MVN archetype:generate-darchetypeartifactid=maven-archetype-quickstart Command: This command is used to select the skeleton for creating a common Java project, The ability to skip the project that created the skeleton directly before those options.

Create success:

Select the skeleton of the common Java project in eclipse to create the project:

Create complete:

Pom file: Open the Pom configuration file in Eclipse, the first entry is to modify the engineering information interface, this interface can modify the project information

Maven command and Pom file constants

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.