days
-1
-8
hours
-2
-2
minutes
-4
-3
seconds
-2
-8
search
Building up the build tool

Gradle 2.3 allows access to metadata artifacts

JAX Editorial Team
Building image via Shutterstock

The open source build automation system has now given us Gradle 2.3, which packs a punch with access to metadata artifacts, greater IDE support and as always, a swath of community contributions.

The build tool Gradle has released version 2.3, with the update extending the possibilities of dependency management and IDE support, on top of improvements to some core plugins.

Gradle 2.3 features

Following on from the inclusion of a query API for resolving component artifacts in Gradle 2.0, an incubating feature that has been requested by the community for some time is finally available in this newest release: access to metadata artifacts for Ivy and Maven modules.

By accessing the ivy.xml or module.pom file that Gradle uses when resolving a dependency, the Ivy descriptor artifact can be retrieved as follows:

task resolveIvyDescriptorFiles {
    doLast {
        def componentIds = configurations.compile.incoming.resolutionResult.allDependencies.collect { it.selected.id }

        def result = dependencies.createArtifactResolutionQuery()
            .forComponents(componentIds)
            .withArtifacts(IvyModule, IvyDescriptorArtifact)
            .execute()

        for (component in result.resolvedComponents) {
            component.getArtifacts(IvyDescriptorArtifact).each { assert it.file.name == 'ivy.xml' }
        }
    }
}

Access to these raw metadata artifacts are now available via the Artifact Query API which can be used, for example, to create an offline repository. In order to retrieve the Maven POM artifact and for more details about the API, check out the ArtifactResolutionQuery page.

The interface for component metadata rules has also been enhanced, making it now possible to define rules that only apply to a particular module, as well as rules that apply to all components.

With regards to IDE support, several enhancements have been incorporated to the Gradle tooling API, together with numerous bug fixes. Users now have access to better integration via the eclipse-wtp plugin with the Eclipse Web Tools Platform.

Community contributions are again acknowledged in the new release, with ample improvements to the antlr, compare-gradle-builds and application plugins.

A complete list of changes can be found in the release notes here.

Leave a Reply

Be the First to Comment!

avatar
400
  Subscribe  
Notify of