mulesoft-labs / mule-gradle-plugin

Plugin for building mule apps with the gradle build system.
Apache License 2.0
24 stars 14 forks source link

Uploaded artifact should be a Zip File error when deploying to mmc #60

Closed gilbertg closed 9 years ago

gilbertg commented 9 years ago

Hi, I'm getting the above error when deploying to mmc:

gradlew uploadToRepository -PdeployNum=5 -PdeployEnv=uat
:DragonDto:compileJava UP-TO-DATE                                                        
:DragonDto:processResources UP-TO-DATE     
:DragonDto:classes UP-TO-DATE     
:DragonDto:jar                 
:Shared:compileJava UP-TO-DATE                                                 
:Shared:processResources UP-TO-DATE      
:Shared:classes UP-TO-DATE      
:Shared:jar                 
:ESB:compileJava                                                         
warning: [options] bootstrap class path not set in conjunction with -source 1.7
1 warning                        
:ESB:processResources UP-TO-DATE      
:ESB:classes                 
:ESB:compileTestJava                                                             
warning: [options] bootstrap class path not set in conjunction with -source 1.7
Note: S:\VATit\Blaze\ESB\src\test\java\TestLogin.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 warning                            
:ESB:processTestResources UP-TO-DATE      
:ESB:testClasses                 
:ESB:unpackClover                                                                    
:ESB:unpackPluginJars                 
:ESB:test                                                             
:ESB:check                 
:ESB:mulezip                                                                 
:ESB:assemble                 
:ESB:build                 
:ESB:uploadToRepository                 
Deploying Blaze v1.3.5 to UAT           
        Uploading app to environment {url}
[FAILED!!] Uploaded artifact should be a Zip File
:ESB:uploadToRepository FAILED          

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ESB:uploadToRepository'.
> Uploaded artifact should be a Zip File

* Try:         
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED   

Total time: 2 mins 46.349 secs 

Total time: 2 mins 46.349 secs

My build script:

buildscript {

    dependencies {
        classpath group: 'org.mulesoft.build', name: 'mule-gradle-plugin', version: '1.2.0'
    }

    repositories {
        mavenLocal()
        maven { url 'http://repository.mulesoft.org/releases' }
        mavenCentral()
    }
}

sourceCompatibility = '1.7'
targetCompatibility = '1.7'

apply plugin: 'mulestudio'
apply plugin: 'mmc'

dependencies {
    compile project(':Shared')
    compile project(':DragonDto')

    compile group: 'javax.activation', name: 'activation', version: '1.1'
    compile group: 'javax.xml.stream', name: 'stax-api', version: '1.0-2'
    compile group: 'log4j', name: 'apache-log4j-extras', version: '1.2.17'
}

mule.version = '3.5.2'

mule.muleEnterprise = true
mule.enterpriseRepoUsername = '{my-username}'
mule.enterpriseRepoPassword = '{my-password}'

project.ext {
    deployNum = has('deployNum') ? deployNum : 0
    deployEnv = has('deployEnv') ? deployEnv : 'uat'
}

version = rootProject.version

mmc.environments {
    uat url: '{my-url}', username: '{my-username}', password: '{my-password}', appName: 'Blaze', version: "${rootProject.version}.$project.ext.deployNum"
    live url: '{my-url}', username: '{my-username}', password: '{my-password}', appName: 'Blaze'
    defaultEnvironment = project.ext.deployEnv
}

mule.components {
    module name: 'mule-module-sharepoint', version: '2.1.1', noClassifier: true, noExt: true
    module name: 'mule-module-apikit-plugin', version: '1.5.2', noClassifier: true

    module name: 'mule-module-objectstore', version: '1.3.1'

    plugin group: 'org.mule.modules', name: 'mule-module-objectstore', version: '1.3.1'
    plugin group: 'com.mulesoft.security', name: 'mule-module-security-oauth2-provider', version: '1.4.0', noClassifier: true, noExt: true
    plugin group: 'com.mulesoft.security', name: 'mule-module-security-property-placeholder', version: '1.4.0', noClassifier: true, noExt: true
}

uploadToRepository.doFirst {
    println "Deploying Blaze v${rootProject.version}.${project.ext.deployNum} to ${project.ext.deployEnv.toUpperCase()}"
}
juancavallotti commented 9 years ago

@gilbertg in this case, the server is returning 501,

in your doFirst, can you print the result of the following expression?

project.configurations.archives.allArtifacts.files.singleFile
gilbertg commented 9 years ago

S:\VATit\Blaze\ESB\build\ESB-1.3.zip

I did upload this file manually to the mmc - and it deployed ok.

juancavallotti commented 9 years ago

@gilbertg can you please try and upload this through the MMC API with the same parameters? If you get the same error then it might be worth to report to support as a mmc api bug.

gilbertg commented 9 years ago

OK cool - i also get a 501 through manual post to API - will submit to Mule support. Thanks

gilbertg commented 9 years ago

OK, so this was a permissions issue. For the record, the user must have the 3 "repository item" permissions, and the default Deployers group does not have them. I have asked Mule support to correct the return status for this situation.