Customize dependency file names in maven

蹲街弑〆低调 提交于 2021-02-17 06:22:06

问题


I'm using maven-dependency-plugin to copy dependency jars into specific folder. I'm looking the way to customize copied jar file names using dependency properties: groupid, artifactid and version.

example:

I have following dependency

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-lang3</artifactId>
    <version>3.3.2</version>
</dependency>

I'd like to copy dependency jar as "org.apache.commons.commons-lang3-3.3.2.jar"

How can I accomplish this?


回答1:


I was able to achieve this using "prependGroupId" parameter.

Sample configuration snippet:

    <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>
                    <prependGroupId>true</prependGroupId>
                </configuration>
            </execution>
        </executions>
    </plugin>


来源:https://stackoverflow.com/questions/28863247/customize-dependency-file-names-in-maven

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!