maven exports the jar package that the project depends on

https://my.oschina.net/cloudcoder/blog/212648

Abstract: When deploying the project, you need to export the jars that the maven project depends on to the specified directory. This article explains how to export the jar packages that the project depends on.

 

When deploying the project, you need to export the jars that the maven project depends on to the specified directory. This article explains how to export the jar packages that the project depends on.

 

1. Export to the default directory  targeted/dependency 

    Export the jar package that the project depends on from the Maven project: enter the directory where the project pom.xml is located, and execute the following command:

 

1
mvn dependency:copy-dependencies
       Or in eclipse, select the pom.xml file of the project, click Run As in the right-click menu, see the red box in the figure below, in the pop-up Configuration window, enter  dependency: copy-dependencies , and click Run

      The jar packages that the maven project depends on will be exported to the targeted/dependency directory.



2. Export to a custom directory

    Create a lib folder under the maven project and enter the following command:

 

1
mvn dependency:copy-dependencies -DoutputDirectory=lib
    The jar packages that the maven project depends on will be copied to the lib directory in the project directory

3. Set the dependency level

    At the same time, the dependency level can be set, usually the compile level is used

 

1
mvn dependency:copy-dependencies -DoutputDirectory=lib   -DincludeScope=compile

Guess you like

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