2

I'm moving from Maven to Gradle, In my maven code i used the "maven-dependency-plugin" and i could not find an easy translation for the following: so my question is how can i get my dependencies into a specific structure?

<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>
Yosefki
  • 383
  • 7
  • 22
  • Have a look at this answer [enter link description here](http://stackoverflow.com/questions/16636702/gradle-equivalent-of-maven-dependency-plugin) – junior developper Mar 27 '17 at 08:34

2 Answers2

0

so finding no equivalent in Gradle what i ended up doing is holding a map of artifact id to the new name (outputDirectory + destFileName) and after resolving the dependencies into a new special configuration which i called "Flex" and then renaming every dependencies from "flex" using the mapping.

Yosefki
  • 383
  • 7
  • 22
0

For those looking for Maven-like dependency management features in Gradle, check out the Dependency Management Plugin. It provides familiar dependencyManagement blocks and BOM support.

Note that you don't need to use Spring in your project to use the plugin.

Eron Wright
  • 1,022
  • 12
  • 10