Unpack wsdl schema from dependencies in Gradle

Dmitry Senkovich

I've got the following plugin configuration in a Maven (for now) project:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <executions>
        <execution>
            <id>unpack</id>
            <phase>initialize</phase>
            <goals>
                <goal>unpack</goal>
            </goals>
            <configuration>
                <includes>**/*.xsd,**/*.wsdl</includes>
                <outputDirectory>${project.build.directory}/schema</outputDirectory>
                <artifactItems>
                    <artifactItem>
                        <groupId>com.someCompany.someTeam.someProject</groupId>
                        <artifactId>someProject-wsdl</artifactId>
                    </artifactItem>
                    <artifactItem>
                        <groupId>com.someCompany</groupId>
                        <artifactId>someCompany-xsd</artifactId>
                    </artifactItem>
                    <artifactItem>
                        <groupId>com.someCompany.someTeam</groupId>
                        <artifactId>common-schema</artifactId>
                    </artifactItem>
                </artifactItems>
            </configuration>
        </execution>
    </executions>
</plugin>

Unfortunately, I can't find something similar in Gradle. The only thing I've found is creating a task, loading artifacts as zip files (specifying the whole path to the artifact) and then unzip it.

Is there any other alternative? Thank you very much for any help!

Louis Jacomet

Here is another way, that is closer to Gradle best practices:

repositories {
  mavenLocal()
}

configurations {
  xsdSources { // Defined a custom configuration
    transitive = false // Not interested in transitive dependencies here
  }
}

dependencies {
  xsdSources "com.someCompany.someTeam.someProject:someProject-wsdl:$someVersion"
  xsdSources "com.someCompany.someTeam:otherArtifact:$otherVersion"
}

task copyWsdlFromArtifacts(type: Copy) {
  from configurations.xsdSources.files.collect { zipTree(it)}
  into "$buildDir/schema"
  include '**/*.xsd', '**/*.wsdl'
  includeEmptyDirs = false
}

The benefit is that there is a clear split between where the files are coming from (repositories), which files (dependencies) and what to do with them (task definition).

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to unpack just the files from a sub-folder in maven-dependency-plugin with goal unpack-dependencies?

From Java

JAX-WS: Compile Schema separate from WSDL

From Java

How to update Gradle dependencies from command line?

From Dev

gradle exclude specific jars from runtime dependencies

From Dev

Get dependencies from resolve configuration on Gradle 4.1

From Java

Excluding Tomcat dependencies from Spring Boot in Gradle

From Dev

Excluding the same group from multiple dependencies in gradle?

From Dev

Creating correct Maven dependencies from Gradle

From Dev

Android library dependencies missing from POM with Gradle

From Dev

Gradle transitive dependencies from Task defined in buildSrc

From Dev

How to read the dependencies from an eclipse .classpath in gradle?

From Dev

Gradle ear build with dependencies from war file

From Dev

Gradle build using plugins and dependencies from "flatDir"

From Dev

Which formats can the dependencies:unpack-dependencies goal unpack?

From Dev

Gradle - Exclude dependencies of dependencies

From Dev

Generate WCF [ServiceContract] from WSDL using SvcUtil: can't find Schema information

From Dev

Copy all dependencies from one Gradle configuration to another

From Dev

Copy Gradle dependencies from another subproject without deprecation warning

From Dev

Dependencies not resolved after gradle upgrade from 1.12 to 2.4

From Dev

Spring boot, exclude dependencies from test in Gradle 5

From Dev

Use Apple dependencies, more specifically SwiftUI, from Kotlin/Native with Gradle

From Java

Gradle can't get dependencies from nexus repository?

From Java

How to define common dependencies in Gradle kotlin dsl from the parent project?

From Dev

Gradle doesn't download transitive dependencies from local jar

From Dev

gradle does not fetch dependencies after upgrade from 5.1.1 to 6.4.1

From Dev

How to execute "./gradlew build --refresh-dependencies" from gradle plugin

From Dev

Add sourceSet and dependencies to a gradle build script which inherits from main

From Dev

How do I stop gradle from upgrading transitive dependencies?

From Dev

Prevent Gradle Zip task from downloading dependencies before task execution

Related Related

  1. 1

    How to unpack just the files from a sub-folder in maven-dependency-plugin with goal unpack-dependencies?

  2. 2

    JAX-WS: Compile Schema separate from WSDL

  3. 3

    How to update Gradle dependencies from command line?

  4. 4

    gradle exclude specific jars from runtime dependencies

  5. 5

    Get dependencies from resolve configuration on Gradle 4.1

  6. 6

    Excluding Tomcat dependencies from Spring Boot in Gradle

  7. 7

    Excluding the same group from multiple dependencies in gradle?

  8. 8

    Creating correct Maven dependencies from Gradle

  9. 9

    Android library dependencies missing from POM with Gradle

  10. 10

    Gradle transitive dependencies from Task defined in buildSrc

  11. 11

    How to read the dependencies from an eclipse .classpath in gradle?

  12. 12

    Gradle ear build with dependencies from war file

  13. 13

    Gradle build using plugins and dependencies from "flatDir"

  14. 14

    Which formats can the dependencies:unpack-dependencies goal unpack?

  15. 15

    Gradle - Exclude dependencies of dependencies

  16. 16

    Generate WCF [ServiceContract] from WSDL using SvcUtil: can't find Schema information

  17. 17

    Copy all dependencies from one Gradle configuration to another

  18. 18

    Copy Gradle dependencies from another subproject without deprecation warning

  19. 19

    Dependencies not resolved after gradle upgrade from 1.12 to 2.4

  20. 20

    Spring boot, exclude dependencies from test in Gradle 5

  21. 21

    Use Apple dependencies, more specifically SwiftUI, from Kotlin/Native with Gradle

  22. 22

    Gradle can't get dependencies from nexus repository?

  23. 23

    How to define common dependencies in Gradle kotlin dsl from the parent project?

  24. 24

    Gradle doesn't download transitive dependencies from local jar

  25. 25

    gradle does not fetch dependencies after upgrade from 5.1.1 to 6.4.1

  26. 26

    How to execute "./gradlew build --refresh-dependencies" from gradle plugin

  27. 27

    Add sourceSet and dependencies to a gradle build script which inherits from main

  28. 28

    How do I stop gradle from upgrading transitive dependencies?

  29. 29

    Prevent Gradle Zip task from downloading dependencies before task execution

HotTag

Archive