d10xa / gradle-download-xml-plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Gradle Download Xml Plugin

Build Status Download

Apply plugin

Gradle >= 2.1

plugins {
    id 'ru.d10xa.download-xml' version '0.0.4'
}

Gradle < 2.1

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'ru.d10xa:gradle-download-xml-plugin:0.0.4'
    }
}

apply plugin: 'ru.d10xa.download-xml'

Usage

task downloadWsdl << {
    println 'Downloading...'
    
    downloadXml {
        src(['http://www.predic8.com:8080/crm/CustomerService?wsdl'])
        dest buildDir
        namespaceToFile([
                'http://predic8.com/wsdl/crm/CRMService/1/': 'service.wsdl',
                'http://predic8.com/crm/1/'                : 'a/b/c/schema-crm.xsd',
                'http://predic8.com/common/1/'             : 'x/y/z/schema-common.xsd'
        ])
        // username 'foo' // optional
        // password 'bar' // optional
        // locations {
        //      malformedLocationHandler { 
        //          "http://localhost:8080/$it" // optional
        //      } 
        // }
    }
    
    println 'Download Complete...'
}

schema locations will be overwritten by the relative

<!--in a/b/c/schema-crm.xsd-->
<xsd:import schemaLocation="../../../x/y/z/schema-common.xsd"
    namespace="http://predic8.com/common/1/"></xsd:import>

Malformed schema locations

You can handle local schema locations with malformedLocationHandler

locations { 
    malformedLocationHandler { "http://localhost:8080/$it" }
}

About


Languages

Language:Groovy 100.0%