Skip to content

Server stops immediately when runPlay is run from another tasks #158

@cataphract

Description

@cataphract

Gradle 6.6.1. Version 0.10

Not sure what's going on here. The application runs fine from the distribution tar and if runPlay is called directly. I can see that the server starts and that port 8080 is bound but then PlayWorkerServer::stop() is called.

// TOP project
def jvmArgs = /* ... */
def createSampleAppTarget = { name, target ->
    tasks.create(name: name, type: GradleBuild, dependsOn: shadowJar) {
        description = "Run $target with instrumentation"
        group = 'application'

        startParameter = startParameter.newInstance()
        startParameter.projectProperties = [
                jvmArgs       : "-javaagent:$shadowJar.archivePath $jvmArgs",
                debugJvm      : project.hasProperty('debugJvm') ? project.debugJvm : 'false',
        ]
        tasks = [target]
    }
}

createSampleAppTarget 'runInstrumentedPlayApp', ':samplePlayApp:runPlay'
// SUBPROJECT
runPlay {
    httpPort = 8080

    // TODO: possible to change executable? doesn't look like so
    def jvmArgs = []
    if (project.hasProperty('jvmArgs')) {
        jvmArgs += (project.jvmArgs.split(/\s+/) as List)
    }

    if (project.hasProperty('debugJvm') && project.debugJvm == 'true') {
        jvmArgs += ['-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=0.0.0.0:5005']
    }
    forkOptions.jvmArgs = jvmArgs
}

I can't reproduce this is the task that calls the runPlay task is in the same project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions