mavens maven-dependency-plugin的Gradle等价物

时间:2016-05-26 09:32:22

标签: maven gradle dependency-management

我正从Maven搬到Gradle, 在我的maven代码中,我使用了“maven-dependency-plugin” 我找不到以下的简单翻译: 所以我的问题是如何将我的依赖项纳入特定的结构?

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>2.6</version>
    <executions>
        <execution>
            <id>copy</id>
            <phase>prepare-package</phase>
            <goals>
                <goal>copy</goal>
            </goals>
            <configuration>
                <artifactItems>
                    <artifactItem>
                        <groupId>com.group1</groupId>
                        <artifactId>artifact1</artifactId>
                        <version>1</version>
                        <type>swf</type>
                        <outputDirectory>/flex/output1</outputDirectory>
                        <destFileName>artifact1.swf</destFileName>
                    </artifactItem>
                    <artifactItem>
                        <groupId>com.group2</groupId>
                        <artifactId>artifact2</artifactId>
                        <version>2</version>
                        <type>swf</type>
                        <outputDirectory>/flex/output2</outputDirectory>
                        <destFileName>artifact2.swf</destFileName>
                    </artifactItem>
                    <artifactItem>
                        <groupId>com.group3</groupId>
                        <artifactId>artifact3</artifactId>
                        <version>3</version>
                        <type>swf</type>
                        <outputDirectory>/flex/output3</outputDirectory>
                        <destFileName>artifact3.swf</destFileName>
                    </artifactItem>
                </artifactItems>
                <overWriteReleases>false</overWriteReleases>
                <overWriteSnapshots>true</overWriteSnapshots>
            </configuration>
        </execution>
    </executions>
</plugin>

2 个答案:

答案 0 :(得分:0)

所以在Gradle中找不到相应的东西我最终做的是将工件id的映射保存到新名称(outputDirectory + destFileName),并在将依赖项解析为我称为&#34; Flex&#34的新特殊配置之后;然后从&#34; flex&#34;重命名每个依赖项。使用映射。

答案 1 :(得分:0)

对于那些在Gradle中寻找类似Maven的依赖关系管理功能的人,请查看Dependency Management Plugin。它提供熟悉的dependencyManagement块和BOM支持。

请注意,您不需要在项目中使用Spring来使用插件。