GoogleCloudPlatform / app-gradle-plugin

The library has moved to https://github.com/GoogleCloudPlatform/appengine-plugins/tree/main/app-gradle-plugin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Plugin detection doesn't support overridden web directory

angryziber opened this issue · comments

It seems it looks for src/main/webapp, however war plugins supports overriding the location with:

webAppDirName = 'web'

It confuses the plugin and appengine-web.xml is not detected. By default, the yml version is selected, which doesn't have the appengineRun taks that is referenced in the documentation.

Workaround: specify the xml plugin explicitly:
apply plugin: 'com.google.cloud.tools.appengine-appenginewebxml'

It's interesting that this does not work. The code is actually trying to ask Gradle for the location of webAppDirName, but WarPluginConvention insists that the path is the default src/main/webapp.

Thank you for providing the workaround.

commented

Right, so this is an artifact of this plugin being originally written to do too much. The plugin is doing best effort to detect if there is an appengine-web.xml, however this detection happens before projects are configured. See configuration phases: https://docs.gradle.org/current/userguide/build_lifecycle.html#sec:build_phases

We can't see the custom webAppDirName because it is not set when we are trying to read the value (before project's are configured, and user configuration is loaded).
We can't use the project.afterEvaluate{} block to make sure the variable is set, because it would be too late (after project configuration) to apply either the correct plugin (appenginewebxml or appyaml).

Thanks, @loosebazooka ! I'll document this limitation.