Mvn install or Mvn package

后端 未结 8 1240
清歌不尽
清歌不尽 2020-12-07 13:41

I am new to Maven, I have a Java based web project with maven configured in my MyEclipse.
Now if I modified any java files then do I need to do Run as -> Mvn in

相关标签:
8条回答
  • 2020-12-07 14:15

    mvn install is the option that is most often used.
    mvn package is seldom used, only if you're debugging some issue with the maven build process.

    See: http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

    Note that mvn package will only create a jar file.
    mvn install will do that and install the jar (and class etc.) files in the proper places if other code depends on those jars.

    I usually do a mvn clean install; this deletes the target directory and recreates all jars in that location.
    The clean helps with unneeded or removed stuff that can sometimes get in the way.
    Rather then debug (some of the time) just start fresh all of the time.

    0 讨论(0)
  • 2020-12-07 14:19

    package - takes the compiled code and package it in its distributable format, such as a JAR or WAR file. install - install the package into the local repository, for use as a dependency in other projects locally

    0 讨论(0)
提交回复
热议问题