Go: Maven common commands

Source: Internet
Author: User
Tags sonatype

MAVEN Library:


Maven Dependency Query:


Maven Common commands:
1. Create a generic Java project for Maven:
MVN archetype:create
2. Create a MAVEN Web project:
MVN archetype:create
3. Compiling source code: MVN Compile
4. Compiling test code: MVN test-compile
5. Run the test: MVN test
6. Generate SITE:MVN Site
7. Packaging: MVN Package
8. Installing the JAR:MVN install in the local repository
9. Clear the resulting project: MVN clean
10. Build Eclipse Project: MVN eclipse:eclipse
11. Generate the Idea project: MVN Idea:idea
12. Combine with goal commands, such as package-only not tested: Mvn-dtest packages
13. Compile the content of the test: MVN test-compile
14. Only hit jar package: MVN Jar:jar
15. Test without compiling and not compiling: mvn test-skipping compile-skipping Test-compile
(-skipping's flexible use, of course, can also be used for other combination commands)
16. Clear some system settings for Eclipse: mvn Eclipse:clean


The general usage is this, first through CVS or svn download code to the native, then execute MVN eclipse:eclipse generate Ecllipse project file, and then import to eclipse on the line, modify the code after the MVN compile or MVN test test, You can also download the Maven plugin for Eclipse.

Mvn-version/-v displaying version information
MVN archetype:generate Creating a MVN project
MVN Archetype:create-dgroupid=com.oreilly-dartifactid=my-app Creating a MVN project

MVN package generates target directory, compiles, tests code, generates test reports, generates Jar/war files
MVN Jetty:run runs the project on jetty,
MVN Compile compilation
MVN Test compiles and tests
MVN clean empties the resulting file
MVN site to generate project-related information
mvn-dwtpversion=1.0 eclipse:eclipse Build a WTP plug-in Web project
mvn-dwtpversion=1.0 Eclipse:clean Clearing configuration information for Eclipse projects (Web project)
MVN eclipse:eclipse Convert project to eclipse project

Using multiple repositories with applications
<name>planet mirror</name>

MVN Deploy:deploy-file-dgroupid=com-dartifactid=client-dversion=0.1.0-dpackaging=jar-dfile=d:\client-0.1.0.jar- drepositoryid=maven-repository-inner-durl=ftp://xxxxxxx/opt/maven/repository/

To publish a third-party jar to a local library:

MVN install:install-file-dgroupid=com-dartifactid=client-dversion=0.1.0-dpackaging=jar-dfile=d:\ Client-0.1.0.jar



MVN-E displays detailed error information.

MVN Validate verify that the project is correct and that all required resources are available.
MVN Test-compile Compile the project test code:
MVN integration-test processes and publishes packages in an environment where integration testing can run.
MVN verify runs any checks to verify that the package is valid and meets quality standards.
MVN Generate-sources generates any additional source code that the application requires, such as Xdoclet.

This article from Csdn Blog, reproduced please indicate the source: http://blog.csdn.net/lifxue/archive/2009/10/14/4662902.aspx

Common commands:
MVN-V Display version
MVN Help:describe-dplugin=help uses the describe target of the help plugin to output the information for the Maven add plugin.
MVN help:describe-dplugin=help-dfull using the Help plugin to output a complete set of target columns with parameters
MVN Help:describe-dplugin=compiler-dmojo=compile-dfull Gets the information for a single target, sets the mojo parameters and plugin parameters. This command lists all the information for the compile target of the compiler plug-in
MVN Help:describe-dplugin=exec-dfull lists the targets available for all Maven exec plugins
MVN Help:effective-pom See this "active (Effective)" Pom, which exposes MAVEN's default settings

MVN archetype:create-dgroupid=org.sonatype.mavenbook.ch03-dartifactid=simple-dpackagename= Org.sonatype.mavenbook creating a Maven Generic Java project, using the Maven archetype plugin on the command line
The MVN exec:java-dexec.mainclass=org.sonatype.mavenbook.weather.main exec plugin allows us to run this program without loading the appropriate dependencies into classpath.
MVN dependency:resolve Print out a list of resolved dependencies
MVN Dependency:tree Print the entire dependency tree

MVN Install-x want to see the complete dependency trail, including those that were rejected for conflict or other reasons, to open Maven's debug tag run
MVN install-dmaven.test.skip=true Add Maven.test.skip attribute to any target to skip the test
MVN install assembly:assembly Build assembly MAVEN Assembly plugin is a plugin to create your application-specific distribution package

MVN Jetty:run calls the run target of the jetty plugin to launch the web App in the Jetty Servlet container
MVN Compile compiling your project
MVN clean install Remove and recompile

MVN HIBERNATE3:HBM2DDL using the Hibernate3 plugin to construct the database

Go: Maven common commands

Related Article

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.