如何使用maven依赖插件将类型为pom的依赖项复制到一个位置

问题描述 投票:0回答:1

需要解析以下依赖项并将子依赖项复制到特定位置。

    <dependency>
        <groupId>org.wildfly</groupId>
        <artifactId>wildfly-ejb-client-bom</artifactId>
        <version>${version.org.wildfly.wildfly-ejb-client-bom}</version>
        <type>pom</type>
        <scope>import</scope>   
    </dependency>
    <dependency>
        <groupId>org.wildfly</groupId>
        <artifactId>wildfly-jms-client-bom</artifactId>
        <version>${version.org.wildfly.wildfly-jms-client-bom}</version>
        <type>pom</type>
        <scope>import</scope>
    </dependency>

但是当我使用maven依赖插件进行复制时,只复制pom文件,而不是那些pom中定义的依赖项。

我的插件如下,

       <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
                <execution>
                    <id>copy-dependencies</id>
                    <phase>prepare-package</phase>
                    <goals>                         
                        <goal>copy</goal>
                    </goals>                        
                    <configuration>
                        <artifactItems>
                            <artifactItem>
                                <groupId>org.wildfly</groupId>
                                <artifactId>wildfly-ejb-client-bom</artifactId>
                                <version>${version.org.wildfly.wildfly-ejb-client-bom}</version>
                                <type>pom</type>
                                <outputDirectory>${project.build.directory}/Lib</outputDirectory>   
                            </artifactItem>
                            <artifactItem>
                                <groupId>org.wildfly</groupId>
                                <artifactId>wildfly-jms-client-bom</artifactId>
                                <version>${version.org.wildfly.wildfly-jms-client-bom}</version>
                                <type>pom</type>
                                <outputDirectory>${project.build.directory}/Lib</outputDirectory>
                            </artifactItem>                             
                        </artifactItems>
                    </configuration>
                </execution>
            </executions>
        </plugin>

任何线索?

maven dependencies maven-dependency-plugin
1个回答
0
投票

使用<scope>import</scope>管理来自其他项目的依赖项。有关详细解决方案,请参阅Maven文档中的this

© www.soinside.com 2019 - 2024. All rights reserved.