Getting Maven (Maven jar package import; the role of each directory maven project files!)

A .pom.xml settings:

To add the jar package are in: http://mvnrepository.com like!:





Remember, this is not a direct input, but the copy, if the direct setting may be wrong!

Two .Maven commonly used commands:

--> mvn -version

        Role: display Maven version, and the version of jdk (should Maven is a pure Java compiler)

--->mvn  clean 

        Role: clear compiled file (it means deleting the target directory)

--->mvn  compile

          Role: Compile your home directory files (generated target file!)

              

            

target is to store project files and the build  directory , jar package, war package, compiled

class files are generated when all the Maven build.

--->mvn package

Packaging commands (Java project --- packing ---> jar; web project --- packing ---> war package)

After packaging a series of commands generated file as shown below:


--->mvn install:

            Role: publish a project to a local warehouse, (usually on private servers, shared some of that enterprise Java generic packages, package them into a jar package on the enterprise server so that everyone can use!)

            

--->mvn test 

            Role: Catalog code compile and run the test

--->mvn tomcat:run

            Role: a key to start tomcak,

            注意:这里的tomcat不是你电脑中配置的tomcat,而是你在执行这个命令的时候,Maven生成的Tomcat环境,他会将你已经存在的war包,自动解压到生成的Tomcat下的webapp文件夹下,并启动这个tomcat,这样你的服务器就算是搭建起来了!



三.maven工程目录中各个文件的作用:



发布了79 篇原创文章 · 获赞 89 · 访问量 2万+

Guess you like

Origin blog.csdn.net/qq_39141486/article/details/103008614