Turn: MAVEN common commands

Maven repository:

http://repo2.maven.org/maven2/

Maven dependency query:

http://mvnrepository.com/

Maven common commands:
1. Create a common Maven java project:
   mvn archetype:create
   -DgroupId=packageName
   -DartifactId =projectName 
2. Create a Maven web project:  
    mvn archetype:create
    -DgroupId=packageName   
    -DartifactId=webappName
    -DarchetypeArtifactId=maven-archetype-webapp   
3. Compile the source code: mvn compile
4. Compile the test code: mvn test-compile   
5. Run the test: mvn test  
6. Generate site: mvn site  
7. Package: mvn package  
8. Install the jar in the local Repository: mvn install
9. Clean the generated project: mvn clean  
10. Generate the eclipse project: mvn eclipse:eclipse 
11. Generate an idea project: mvn idea:idea 
12. Use the goal command in combination, such as only packaging without testing: mvn -Dtest package  
13. Compile the test content: mvn test-compile 
14. Only jar package: mvn jar:jar 
15 . Only test without compiling, and do not test compilation: mvn test -skipping compile -skipping test-compile
      (the flexible use of -skipping, of course, can also be used for other combined commands) 
16. Clear some system settings of eclipse: mvn eclipse: clean 

ps:

the general usage is like this, first download the code to the machine through cvs or svn, then execute mvn eclipse:eclipse to generate the ecllipse project file, and then import it into eclipse; after modifying the code, execute mvn compile or mvn test to check, also You can download the maven plugin for eclipse.

mvn -version/-v Display version information
mvn archetype:generate Create mvn project
mvn archetype:create -DgroupId=com.oreilly -DartifactId=my-app Create mvn project

mvn package Generate target directory, compile, test code, generate test report, Generate jar/war file
mvn jetty:run to run the project on jetty,
mvn compile compiles
mvn test compiles and tests
mvn clean clears the generated files
mvn site generates a website for project-related information
mvn -Dwtpversion=1.0 eclipse:eclipse generates a Wtp plug-in Web project
mvn -Dwtpversion=1.0 eclipse:clean clears the configuration information of the Eclipse project (Web project)
mvn eclipse:eclipse Convert project to Eclipse project Use multiple repositories

in application
<repositories>   
    <repository>     
        <id>Ibiblio</id>     
        <name>Ibiblio</name>     
        <url>http: //www.ibiblio.org/maven/</url>   
    </repository>   
    <repository>     
        <id>PlanetMirror</id>     
        <      name>Planet Mirror</name>     
        <url>http://public.planetmirror.com/pub/maven/</url>   
    </repository> 
</repositories>


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/


Publish the third-party Jar to the local repository:

mvn install :install-file -DgroupId=com -DartifactId=client -Dversion=0.1.0 -Dpackaging=jar -Dfile=d:\client-0.1.0.jar


-DdownloadSources=true

-DdownloadJavadocs=true

mvn -e show detailed error information .

mvn validate verifies that the project is correct and that all required resources are available.
mvn test-compile compiles the project test code. .
mvn integration-test processes and publishes packages in an environment where integration tests 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 required by the application, such as xdoclets.

This article is from CSDN blog, please indicate the source for reprint: http://blog.csdn.net/lifxue/archive/2009/10/14/4662902.aspx

Common commands:
mvn -v display version
mvn help:describe -Dplugin=help use help plugin's describe goal to output information about the Maven Help plugin.
mvn help:describe -Dplugin=help -Dfull Use the Help plugin to output the complete target list with parameters
mvn help:describe -Dplugin=compiler -Dmojo=compile -Dfull Get information about a single target, set mojo parameters and plugin parameters. This command lists all the information about the compile goal of the Compiler plugin
mvn help:describe -Dplugin=exec -Dfull lists all the goals available for the Maven Exec plugin
mvn help:effective-pom Look at this "effective" POM, it Exposes Maven's default settings

mvn archetype:create -DgroupId=org.sonatype.mavenbook.ch03 -DartifactId=simple -DpackageName=org.sonatype.mavenbook Creates a normal Maven java project, using the Maven Archetype plugin on the command line
mvn exec:java -Dexec.mainClass=org.sonatype.mavenbook.weather.Main The Exec plugin allows us to run this program without loading the appropriate dependencies on the classpath
mvn dependency:resolve prints a list of resolved dependencies
mvn dependency:tree prints the entire dependency tree

mvn install -X To see the complete dependency trace, including those that were rejected due to conflicts or other reasons, turn on Maven's debug flag and run
mvn install -Dmaven.test.skip=true Add the maven.test.skip property to any goal to skip tests
mvn install assembly:assembly Build assembly The Maven Assembly plugin is a plugin used to create distributions specific to your application

mvn jetty:run Call the Jetty plugin's Run goal in Jetty Start the web application in the servlet container
mvn compile compile your project
mvn clean install delete and recompile

mvn hibernate3:hbm2ddl use the Hibernate3 plugin to construct the database

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326783170&siteId=291194637