search

Home  >  Q&A  >  body text

java - maven项目什么时候用到编译,打包?

1,在本地new 一个tomcat实例,add一个maven项目到其中,点击run。这个过程是否并不涉及maven的编译等等,这是tomcat自己复制了各个jar,class文件,然后自己运行?
2,那我们一般在本地开发的时候,是不是并不需要maven的编译,打包等操作
3,公司有专门的运维,我们开发好上传到svn,就没开发啥事了。我想了解下之后的流程,各位能否给讲讲?
多谢

高洛峰高洛峰2889 days ago295

reply all(1)I'll reply

  • 天蓬老师

    天蓬老师2017-04-18 09:24:30

    1. Publishing a Maven web project in the IDE involves maven compilation and packaging. You said tomcat自己复制了各个jar,class文件, where did the jar/class files come from? Compiled by maven. Maven web projects in the IDE can usually be published in two ways, war/dir. The war package method involves compilation and packaging. The directory method should be first typed into a war package and then decompressed

    2. During the development process, the IDE will automatically use maven for compilation. For example, if you declare a dependency in the pom, the IDE will automatically introduce the dependency package into the project, and the download of the dependency package relies on maven compilation. And the project's compilation output path is no longer the bin directory of non-maven projects, but the related directory under maven's target.

    3. The next process should be to package and publish it to the online web container


    Some common commands and simple explanations:

    • mvn compile: Download dependencies to the local warehouse (usually ~/.m2/repository), compile the source code and resources and output them to the target/classes directory

    • mvn test-compile: Compile the test source code, the same as above, but output it to the target/test-classes directory

    • mvn test: Run test

    • mvn package: Compile, test and package in the specified format

    • mvn install: Package and install the package into the local repository

    • mvn deploy: Install and publish to the specified remote warehouse

    reply
    0
  • Cancelreply