0
votes

I have a gradle build with Java sub-projects and had a jacoco task defined in the root build.gradle which I'm moving to the sub-projects that only use it.

By doing that though I am hitting an issue in the ear deploymentDescriptor task where and there are multiple webModule definitions. The error I'm seeing in the IDE and gradle command line is:

A problem occurred evaluating project ':deployear'.
> Could not get unknown property 'war' for project ':sub-project-two' of type org.gradle.api.Project.

My ear build.gradle contains

apply plugin: 'ear'

ear {
    archiveName = 'web-application.ear'
    appDirName 'src/main/application'
    libDirName 'APP-INF/lib'

    deploymentDescriptor {
        fileName = "application.xml"
        version = "1"
        description = "My Web Application"
        initializeInOrder = true
        displayName = "Web Application"
        webModule(project(":sub-project-one").war.archiveName, "context-root/one")
        webModule(project(":sub-project-two").war.archiveName, "context-root/two")
    }
}

If I comment out webModule(project(":sub-project-two").war.archiveName, "context-root/two") then the project builds successfully. Both sub-project-one and sub-project-one have java and war plugins applied.

Is there a reason why moving a jacoco dependency from a parent build.gradle to some sub-project build.gradle files would generate this error?

1

1 Answers

0
votes

Found a work around.

In my deployear sub-project I added

apply plugin: 'ear'
evaluationDependsOn(':sub-project-two')

and that forced the deployear sub-project to evaluate the sub-project-two project prior to running the ear task. I thought the same could be done with changing the ordering in the parent settings.gradle but that didn't work for me.