mvn command tidy 1.0

The life cycle of the maven project: each set of life cycles is independent of each other and does not affect each other. In a set of life cycle, the previous operation will be automatically executed after executing the following command.

CleanLifeCycle:清理生命周期
clean
defaultLifeCycle:默认生命周期
compile,test,package,install.deploy
siteLifeCycle:站点生命周期
site

Dependency scope in maven:
add dependency scope default is: compile
Provided: run deployment to tomcat is not needed
write picture description here

如果servlet-api设置为compile打包后包含servlet-api.jar包部署到tomcat,跟tomcat中已存在的冲突,导致运行失败。
<scope>provided</scope>   //tomcat自带的jar包,依赖范围设置provided

maven common commands

mvn -v /version display version information

mvn clean clean (delete the compiled content in the target directory)
mvn compile compile the project
mvn clean install delete and then compile

mvn package
generates target directory, compiles and tests code, generates test report, generates jar/war file

mvn test-compile compiles the contents of the
test mvn test runs the test

mvn install -X To see the full dependency trace, including those artifacts that were rejected due to conflicts or other reasons, run
mvn -e with Maven's debug flag on to display detailed error messages.
mvn -X enable full debug logging
mvn exec: java -Dexec.mainClass=”com.keving.demo.Hello”

=======

Package command package, install, deploy

package: packaged to the local compilation directory is generally the target directory
install: packaged locally and pushed to the local warehouse to
deploy: packaged locally and pushed to the local warehouse and uploaded to the remote private server: such as nexus server

mvn -e displays detailed error messages.


mvn site generates a website for project-related information

mvn validate verifies that the project is correct and that all required resources are available.
mvn integration-test processes and publishes packages in an environment where integration tests can run.
mvn verify runs any checks, verifying that the package is valid and meets quality standards.
mvn generate-sources generates any additional source code required by the application, such as xdoclets.
mvn dependency:resolve prints the list of resolved dependencies
mvn dependency:tree prints the entire dependency tree

mvn install assembly:assembly build assembly The Maven Assembly plugin is a plugin for creating distributions specific to your application

mvn jetty:run invokes the Run target of the Jetty plugin to start the web application in the Jetty Servlet container

-Djetty.port=xxxx jetty:run Change jetty default running port

====================================
Install the local jar package to the repository

mvn install:install-file 
-Dfile=<path-to-file> 
-DgroupId=<group-id> 
-DartifactId=<artifact-id> 
-Dversion=<version> 
-Dpackaging=<packaging> 

write picture description here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325814451&siteId=291194637