Gradle没有下载正确的版本

时间:2016-05-26 11:05:04

标签: gradle mule

我想下载依赖项compile' mule-devkit-annotations-3.3.2.jar'。 但它不是下载3.3.2,而是下载3.4.2版本。

这是我的build.gradle文件

import org.apache.tools.ant.filters.ReplaceTokens

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'application'
//apply plugin: 'mule'

//the naming of this artifact
group = 'com.my.project'
version = '0.9.0'
description = "Description here"

//dependencies versions
ext {
    muleVersion = '3.6.2'
}

sourceCompatibility = 1.7
targetCompatibility = 1.7


//application properties
mainClassName = 'org.mule.MuleServer'

repositories {
     mavenLocal()     
     maven { url "https://repository.mulesoft.org/nexus-ee/content/repositories/releases-ee/" }
}

configurations {
    compile
}

dependencies {

    compile group: 'ca.uhn.hapi', name: 'hapi-base', version:'2.2'
    compile group: 'ca.uhn.hapi', name: 'hapi-structures-v231', version:'2.2'
    compile group: 'com.google.guava', name: 'guava', version:'18.0'
    compile group: 'com.googlecode.json-simple', name: 'json-simple', version:'1.1.1'   
    compile group: 'com.mulesoft.muleesb.modules', name: 'mule-module-data-mapper', version:muleVersion
    compile group: 'com.sun.codemodel', name: 'codemodel', version:'2.2'
    compile group: 'com.sun.mail', name: 'javax.mail', version:'1.5.2'
    compile group: 'com.sun.xml.bind', name: 'jaxb1-impl', version:'2.0'
    compile(group: 'com.sun.xml.bind', name: 'jaxb-xjc', version:'2.2.7') {
        exclude(module: 'jaxb-core')
        exclude(module: 'jaxb-impl')
    }
    compile group: 'commons-beanutils', name: 'commons-beanutils', version:'1.8.0'
    compile group: 'javax.activation', name: 'activation', version:'1.1.1'
    compile group: 'javax.xml', name: 'jax-qname', version:'1.1'
    compile group: 'javax.xml', name: 'namespace', version:'1.0.1'
    compile group: 'javax.xml.bind', name: 'jaxb-api', version:'2.2.2'
    compile group: 'javax.xml.parsers', name: 'jaxp-api', version:'1.4.5'
    compile group: 'joda-time', name: 'joda-time', version:'2.6'
    compile group: 'junit', name: 'junit', version:'4.9'
    compile group: 'log4j', name: 'apache-log4j-extras', version:'1.2.17'
    compile group: 'mockobjects', name: 'mockobjects-core', version:'0.09'
    compile group: 'net.sf.json-lib', name: 'json-lib', version:'2.4', classifier:'jdk15'
    compile group: 'opensymphony', name: 'oscore', version:'2.2.4'
    compile group: 'org.apache.ftpserver', name: 'ftplet-api', version:'1.0.6'
    compile group: 'org.apache.ftpserver', name: 'ftpserver-core', version:'1.0.6'
    compile group: 'org.apache.geronimo.specs', name: 'geronimo-javamail_1.4_spec', version:'1.7.1'
    compile group: 'org.apache.mina', name: 'mina-core', version:'2.0.4'
    compile group: 'org.apache.sshd', name: 'sshd-core', version:'0.6.0'
    compile group: 'org.bitbucket.dollar', name: 'dollar', version:'1.0-beta3'
    compile group: 'org.bouncycastle', name: 'bcpkix-jdk15on', version:'1.52'
    compile group: 'org.bouncycastle', name: 'bcprov-jdk15on', version:'1.52'
    compile group: 'org.fusesource.jansi', name: 'jansi', version:'1.8'
    compile group: 'org.glassfish.extras', name: 'bean-validator', version:'4.0.0.Alpha3'
    compile group: 'org.kitchen-eel', name: 'json-schema-validator', version:'1.3.0'
    compile group: 'org.mockito', name: 'mockito-core', version:'1.9.5'
    compile group: 'org.mule', name: 'mule-core', version:muleVersion
    compile group: 'org.mule.modules', name: 'marketo-connector', version:'1.2.5'
    compile group: 'org.mule.modules', name: 'mule-module-apikit', version:'1.3'
    compile group: 'org.mule.modules', name: 'mule-module-apple-push', version:'4.0.0'
    compile group: 'org.mule.modules', name: 'mule-module-devkit-support', version:muleVersion
    compile group: 'org.mule.modules', name: 'mule-module-ms-dynamics-crm-ondemand', version:'1.8.3'
    compile group: 'org.mule.modules', name: 'mule-module-ms-dynamics-crm-onpremise', version:'1.8.3'
    compile group: 'org.mule.modules', name: 'mule-module-s3', version:'2.8.3'
    compile group: 'org.mule.modules', name: 'mule-module-twilio', version:'1.4'
    compile 'org.mule.tools.devkit:mule-devkit-annotations:3.3.2'

    testCompile group: 'org.mule.tests', name: 'mule-tests-functional', version:muleVersion
    testCompile group: 'com.cloveretl', name: 'cloveretl-engine', version:muleVersion
}

distTar.enabled = false


task buildZip (type: Zip){
    def muleconfig='local'
    def muleenv='local'
    def filename = 'twilio' + '-'+ version

    if(project.hasProperty('mule_config') ){
       muleconfig = mule_config

    }

    if(project.hasProperty('mule_env') ){
       muleenv = mule_env

    }

    doFirst{
        println "Copying lib"
        copy {
            from configurations.compile
            into 'build/resources/lib'
        }
        println "Copying src/main/app"
        copy {
            from 'src/main/app'
            into 'build/resources/classes'
            filter(ReplaceTokens, tokens: [muleconfig: muleconfig, muleenv: muleenv])
        }
        copy {
            from 'src/main/app'
            into 'build/resources/'
            filter(ReplaceTokens, tokens: [muleconfig: muleconfig, muleenv: muleenv])
        }

        println "Copying src/main/api"
        copy {
            from 'src/main/api'
            into 'build/resources/classes'
        }

        println "Copying build/resources/main"
        copy {
            from 'build/resources/main'
            into 'build/resources/classes'
        }

        println "Copying deployement script"
        copy {
            from 'src/deployment-script'
            into 'build/deployment-script'
            filter(ReplaceTokens, tokens: [filename: filename])
        }   

    }
    doLast{
        println "Copying zip file to deployment-script"
        copy {
            from 'build/distributions/'
            include '*.zip'
            into 'build/deployment-script'
            rename ('build/distributions/*.zip',
            'build/distributions/${filename}')
        }
    }

    println "Building zip file" 
    from 'build/resources/'
    exclude 'build/resource/main'
}

根据上述版本正确下载mule-module-twilio-1.4.jar。

任何建议都将不胜感激。

1 个答案:

答案 0 :(得分:0)

您可以使用gradle强制依赖版本,但请注意,过时依赖于较新版本的代码可能会中断

 configurations.all {
  resolutionStrategy {
    force 'org.mule.tools.devkit:mule-devkit-annotations:3.3.2'
  }
}