appengine-plugins icon indicating copy to clipboard operation
appengine-plugins copied to clipboard

app-gradle-plugin breaks tasks in multi project build?

Open ciferkey opened this issue 3 years ago • 10 comments

I want to use the frontend-gradle-plugin with this plugin.

If I start with the multi-project-war-application example from the fronend-gradle-plugin everything builds fine.

When I add the app-gradle-plugin using either the method in the documentation the build the fails. For example if I add it through a build script block:

buildscript {
  repositories {
    mavenCentral()
  }

  dependencies {
    classpath 'com.google.cloud.tools:appengine-gradle-plugin:2.4.1'
  }
}

apply plugin: 'com.google.cloud.tools.appengine'

Gradle will fail with:

A problem occurred configuring project ':backend'.
> Could not create task ':backend:processFrontendResources'.
   > Task with name 'assembleFrontend' not found in project ':frontend'.

* Try:
Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Exception is:
org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ':backend'.
	at org.gradle.configuration.project.LifecycleProjectEvaluator.wrapException(LifecycleProjectEvaluator.java:75) 
...

Note that in the example project the build.gradle has the following part:

tasks.register('processFrontendResources', Copy) {
    // Directory containing the artifacts in the frontend project
    def frontendBuildDir = file("${project(':frontend').buildDir}/www")
    // Directory where the frontend artifacts must be copied to be packaged alltogether with the backend by the 'war'
    // plugin.
    def frontendResourcesDir = file("${project.buildDir}/resources/main/public")

    group 'Frontend'
    description 'Process frontend resources'
    dependsOn project(':frontend').tasks.named('assembleFrontend')

    from frontendBuildDir
    into frontendResourcesDir
}

After adding the app-gradle-plugin the dependsOn line fails. Through debugging I've found that project(':frontend').tasks becomes empty after the app-gradle-plugin is added.

What is the app-gradle-plugin doing that is changing tasks in the project? Is there a different way I can look up the assembleFrontend task that will work with the app-gradle-plugin or is the plugin fundamenatally incompatible with multi project gradle builds?

ciferkey avatar Feb 03 '21 19:02 ciferkey