bmuschko / gradle-cargo-plugin

Gradle plugin that provides deployment capabilities to local and remote containers via Cargo
Apache License 2.0
258 stars 63 forks source link

Can't dpeloy ear files to Wildfly 10 #192

Closed deathwaiting closed 5 years ago

deathwaiting commented 5 years ago

Good day

I am trying to use the Cargo plugin to deploy an ear file to local server. but it gives me some some sort of a deadlock here.

if i use the ear plugin , i get the following error: Invalid property [context] for deployable type [ear]

if i remove the context property i get : No value has been specified for property 'deployables.$0.context' so , for ear files i can't use context property , which is for some reason considered mandatory.

i am using gradle 5.2.1 , and this is the cargo configuration in build.gradle

`cargo { containerId = project.property('deployment.cargo.container')

deployable {        
    context = project.property('deployment.context')
}   

local{
    if('true'== project.property('deployment.provision.use'))       
        homeDir = file(buildDir.toString()+'./provisioned-wildfly')
    else
        homeDir = file(project.property('deployment.cargo.container.local.homedir'))
    rmiPort = project.property('deployment.cargo.container.local.rmiport').toInteger()
}

//remote deployment configuration
remote {
    hostname = project.property('deployment.cargo.container.remote.qa.hostname')
    username = project.property('deployment.cargo.container.remote.qa.username')
    password = project.property('deployment.cargo.container.remote.qa.password')

    containerProperties {
        property 'cargo.jboss.management-http.port', project.property('deployment.cargo.container.remote.qa.manageport')
    }
}`
yagotlima commented 5 years ago

I'm facing the same problem.

Looking through the sources I think the following lines are to blame:

https://github.com/bmuschko/gradle-cargo-plugin/blob/e05c8374dffad4a3181f200987021b8c9ae183b6/src/main/groovy/com/bmuschko/gradle/cargo/convention/Deployable.groovy#L32-L33

I believe an @Optional annotation should fix it.

yagotlima commented 5 years ago

Created a pull request to make the property optional.

For now you can clone my fork and checkou branch "issue#192".

Then you can run ./gradlew cargoDeployLocal --include-build path/to/the/fork

deathwaiting commented 5 years ago

@yagotlima thanks a lot , i will try it out

deathwaiting commented 5 years ago

@yagotlima I tested your fork and i was able to successfully deploy ear file to wildfly 10 , thanks again for your effort . P.S : The command ./gradlew cargoDeployLocal --include-build path/to/the/fork will not work if you are using the plugin DSL notation , ex: id "com.bmuschko.cargo" version "2.6"

That's because the "include build" functionality replaces a dependency based on its "groupId: artifactId: version" , but in plugin DSL notation only the groupId and version are specified.

Instead you need the to add this configuration to settings.gradle to explicitly make includeBuild replace the plugin with the forked project includeBuild('./gradle-cargo-plugin') { dependencySubstitution { substitute module('com.bmuschko.cargo:com.bmuschko.cargo.gradle.plugin') with project(':') } }