bmuschko / gradle-cargo-plugin

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

How to get hot deploy working for local? #102

Closed somas closed 10 years ago

somas commented 10 years ago

I have the following settings in build.gradle

cargo {
    containerId = 'tomcat7x'
    port = 9080
    local {
        containerProperties {
            homeDir = file('C:/apache-tomcat-7.0.42')
            property 'cargo.tomcat.ajp.port', 9099
        }

        configFile {
            file = file('src/main/webapp/META-INF/context.xml')
            toDir = new File('conf')
        }

        log = file("C:/apache-tomcat-7.0.42/logs/cargo.log")

        extraClasspath = configurations.cargoRuntime
    }

    deployable {
        file = file('build/libs/developer.war')
        context = 'developer'
    }
}

My application works fine with the above settings but when i make any modification to code nothing happens. Should I be using remote deploy pointed to local and use watch plugin to trigger deploy task?

I do read the following in your readme The typical use case for this plugin is to support deployment during development. Keep in mind that Cargo uses hot deployment which over time fills up the PermGen memory of the JVM process running your container.

Is there an example of how to get hot deploy working for local container?

Thanks

bmuschko commented 10 years ago

Cargo does not support byte-code swapping after a recompile. Is that what you are asking? Hot deployment as described in the plugin documentation assumes the recreation of WAR/EAR file and it's redeployment.

somas commented 10 years ago

Thanks for the explaination.

I am fine with new war creation and redeployment but when running under gradlew (wrapper) cargoRunLocal, I won't be able to trigger another war and deploy, without killing tomcat container. Luckily there is a watch plugin which does exactly that, watches over set of java files for changes and triggers a specific task.

Question is: I don't see a local deploy task, should I use the remote deploy task but point to local instead?

bmuschko commented 10 years ago

What you can do instead is to point the plugin to a remote container that uses localhost as URL. This method assumes that you started the container before manually as separate process.

somas commented 10 years ago

Thanks, I will try that option and see.