【Maven】maven-dependency-plugin

http://maven.apache.org/components/plugins/maven-dependency-plugin/plugin-info.html

A typical scenario:

  1 . Require a special jar package, but there are not directly dependent on obtaining by maven, or that there is no other in the maven repository environment, then how will we need our production into the jar package jar package.

  2. inside a jar file package contains what we need, or we want to extract it out into the location specified, then in addition to copy and paste, how to achieve it through a maven plugin?

Our dependency plug-in is the most commonly used

  dependency:copy 

  dependency:copy-dependencies:Goal that copies the project dependencies from the repository to a defined location.   

  dependency:unpack    

  dependency: unpack-dependencies of these four

To achieve the above two scenarios, what we need is the first and the third.

 copy

  Example: The two specified jar junit slf4j-log4j12 packets are output to the $ {project.build.directory} / lib / lib1 directory i.e. under $ {project.basedir} / target / lib directory.  

  

 

 

 dependency:unpack 

    

 copy-dependencies

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.10</version>
    <executions>
        <execution>
            <id>copy-dependencies</id>
            <phase>package</phase>
            <goals>
                <goal>copy-dependencies</goal>
            </goals>
            <configuration>
                <outputDirectory>${project.build.directory}/deploydependencis</outputDirectory>
                <overWriteReleases>false</overWriteReleases>
                <overWriteSnapshots>false</overWriteSnapshots>
                <overWriteIfNewer>true</overWriteIfNewer>
                <includeScope>compile</includeScope>
                <includeScope>runtime</includeScope>
            </configuration>
        </execution>
    </executions>
</plugin>

 

Guess you like

Origin www.cnblogs.com/clarino/p/12089002.html