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!
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.
Comments