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

Unresolved dependency with some Mule modules #58

Closed gilbertg closed 9 years ago

gilbertg commented 9 years ago

Hi, I'm using the muleEnterprise=true setting - and have valid credentials. With the buildscript below, and calling 'gradle clean studio', i get unresolved dependency message injected into .classpath for all modules except mule-module-objectstore. I have browsed the repo, an at least the security modules seem to be available on the give version. Can you point me in the right direction, as to how you resolved enterprise artefacts, and where i can find locations, versions etc?

btw, this is a great initiative - we're a Gradle shop, and really don't want to learn and adopt Maven. ~gilbert

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()
    }
}

repositories {
    mavenLocal()
    mavenCentral()
}

apply plugin: 'mule'
apply plugin: 'mulestudio'
apply plugin: 'idea'
apply plugin: 'mmc'
apply plugin: 'java'

mule.version = '3.5.2'

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

mule.components {
    module name: 'mule-module-sharepoint', version: '2.1.6'
    module name: 'mule-module-apikit', version: '1.5.2'

    module name: 'mule-module-security-oauth2-provider', version: '1.4.0'
    module name: 'mule-module-security-property-placeholder', version: '1.4.0'
    module name: 'mule-module-objectstore', version: '1.3.1'

    plugin group: 'org.mule.tools', name: 'mule-module-security-property-placeholder', version: '1.3.0'
    plugin group: 'org.mule.modules', name: 'mule-module-sharepoint', version: '2.1.6'
    plugin group: 'org.mule.modules', name: 'mule-module-objectstore', version: '1.3.1'
    plugin group: 'com.mulesoft.security', name: 'mule-module-security-property-placeholder', version: '1.3.0'
}
juancavallotti commented 9 years ago

@gilbertg you had several issues with the dependencies. Your build script should look like the following:

buildscript {

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

    repositories {
        maven { url 'http://repository.mulesoft.org/releases' }
    }
}

repositories {
    mavenLocal()
    mavenCentral()
}

//apply plugin: 'mule' not required, applied automatically by muleStudio
apply plugin: 'mulestudio'
apply plugin: 'idea'
apply plugin: 'mmc'
//apply plugin: 'java' not required, applied automatically by muleStudio or mule

mule.version = '3.5.2'

mule.muleEnterprise = true
mule.enterpriseRepoUsername = eeRepoUser
mule.enterpriseRepoPassword = eeRepoPassword

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
}

A couple of considerations:

You had duplicated dependencies. I can acknowledge that being from the gradle studio plugin, unfortunately there is not enough information in studio to tell if the dependencies are published as a plugin or as a regular jar file. So it is doing just a best optimistic effort assuming everything is correctly packaged.

gilbertg commented 9 years ago

Awesome! its working now, thanks Juan. Question is - how do you know this stuff, or more importantly, how can one know this stuff? Is it possible to introspect the repo?

juancavallotti commented 9 years ago

@gilbertg yes, you can openly browse it with your web browser, i.e. for the salesforce connector:

https://repository.mulesoft.org/nexus/content/repositories/releases/org/mule/modules/mule-module-sfdc/6.1.0/

You will see the artifact deployed with the 'plugin' classifier and the 'zip' extension. If this file is not present then you would need to use the 'noExt' and 'noClassifier'.

For clarity, normally I would declare connectors not published as zip plugins into the regular 'dependencies' section. The dsl was originally thought for simplifying the process of adding zip plugins.