appEngineDirectory ignored for appengine-web.xml
tbook opened this issue · comments
The appEngineDirectory
setting is ignored when searching for appengine-web.xml
. This results in the (rather unhelpful) error, regardless of the value of the setting:
Directory '[...]/src/main/appengine' specified for property 'stagingExtension.appEngineDirectory' does not exist.
Creating the directory produces
com.google.cloud.tools.appengine.AppEngineException: java.nio.file.NoSuchFileException: [...]/src/main/appengine/app.yaml
Placing the file in src/main/webapp/WEB-INF works as expected, but makes it hard to configure different versions of the file.
The error message is saying that the directory does not exist, so I am confused. Where did you put appengine-web.xml
exactly? (Apparently it can't be .../src/main/appengine
, because it doesn't exist.)
Directory '[...]/src/main/appengine' ... does not exist.
In any case, I believe appengine-web.xml
must be under WEB-INF
. (app.yaml
could be a different story.) Is there any doc or account that the file can actually be placed outside WEB-INF
?https://cloud.google.com/appengine/docs/standard/java/config/appref#syntax says
An App Engine Java app must have a file named
appengine-web.xml
in its WAR, in the directoryWEB-INF/
.
makes it hard to configure different versions of the file.
Not sure if this is applicable, but alternatively, you can specify verison
as a parameter of the plugin.
Quite right. Actually, it looks as though the appEngineDirectory
is ignored all together for the appengineDeploy
command. Example:
build.gradle
appengine {
deploy {
projectId = 'my-project-id'
appEngineDirectory = "[path/module]/src/staging"
}
}
Commands:
./gradlew module:appengineDeploy
...
> com.google.cloud.tools.appengine.AppEngineException: java.nio.file.NoSuchFileException: [path/module]/src/main/appengine/app.yaml
However, if I use one of the other commands, it uses that setting:
./gradlew module:appengineDeployCron
...
> [path/module]/src/staging/cron.yaml does not exist.
Possibly that is intended behavior, but it seems odd to have a setting to a path where all of the configuration files (except one) are located.
As I said, the documentation requires appengine-web.xml
be under WEB-INF
, along with files like web.xml
. I believe this is the requirement for the Java 8 App Engine standard. Non-XML (YAML-based) configurations, non-Java environments, or App Engine flexible is a different story. The location of appengine-web.xml
is not configurable and must be under WEB-INF
, as part of the WAR archive.
There are historical and technical reasons that the Java 8 App Engine standard environment remains to be only environment to use the XML-based configuration for the app: it chose the Java Servlet as the basis (using WAR), and the XML configuration seemed a natural choice as one of the foundations of the Servlet technology is XML. The App Engine platform has deprecated all the other XML configurations (cron.xml
, dispatch.xml
, ...) even for the Java 8 environment and migrated to the YAML-based configurations, but because of the strong coupling to Servlet, for Java appengine-web.xml
did not migrate to app.yaml
unlike other environments. The plugin will look for other YAML-based configurations in the appEngineDirectory
, but appengine-web.xml
should still be under WEB-INF
.