什么生成了我的 “appengine-web.xml” 文件?

huangapple go评论59阅读模式
英文:

What generated my "appengine-web.xml" file?

问题

我继承了一个配置在Google App Engine上运行的Java应用程序。我的pom文件包括com.google.appengine.appengine-maven-plugin插件,这可能与这个问题有关。

在我的src目录中,在WEB-INF目录中,我有一个名为"app.yaml"的文件。但是当我的项目构建成一个war文件时,目标目录中既有一个"app.yaml"文件,又有一个"appengine-web.xml"文件。这个"appengine-web.xml"文件是怎么来的?

这个"appengine-web.xml"文件的第一行写着<!-- 从app.yaml生成。请勿编辑。-->。如果这个文件是从一个"app.yaml"文件生成的,那么是什么生成了它?哪个插件/函数创建了这个文件?

英文:

I inherited a Java app that is configured to run in Google App Engine. My pom includes the com.google.appengine.appengine-maven-plugin plugin, which may or may not be related to this question.

In my src directory, in the WEB-INF directory, I have a "app.yaml" file. But when my project is built into a war, the target directory has both a "app.yaml" file and a "appengine-web.xml" file. How did this "appengine-web.xml" file get here?

The first line of this "appengine-web.xml" file says &lt;!-- Generated from app.yaml. Do not edit. --&gt;. If this file was generated from an "app.yaml" file, then what generated it? Which plugin/function has created this file?

答案1

得分: 1

根据官方文档appengine-web.xml 参考所述:

> App Engine Java 应用程序使用名为 appengine-web.xml 的配置文件来指定有关您的应用程序的信息,并标识应用程序的 WAR 文件中的哪些文件是静态文件(如图像),哪些是应用程序使用的资源文件。

因此,这是在使用 App Engine Maven 插件时,默认由 App Engine 环境创建的,因此您可以处理一些特定的设置和配置。您可以在此处找到更多关于这些设置的详细信息,但它包括环境变量的设置、如何扩展应用程序(手动、基本或自动)等。此外,您可以查看这个示例应用程序的例子,该应用程序部署到 war 中并且该文件也被创建了。请记住,这仅适用于 Java 8。

总之,当使用此插件时,App Engine 环境会创建此文件,而不是由特定功能创建的。在这份官方文档此处中也指出了这一点:

> 用于创建项目的工件已为您执行了基本的 src/main/webapp/WEB-INF/appengine-web.xml 配置

因此,这确认了它是通过插件创建的。除此之外,它还显示了与 app.yaml 的关系,因为它们一起工作,每一个都有特定的用途和设置,这些设置对于您的应用程序正常工作是必需的。

如果这些信息有帮助,请告诉我!

英文:

As mentioned in the official documentation appengine-web.xml Reference:

> App Engine Java applications use a configuration file, named appengine-web.xml, to specify information about your app and to identify which files in the app's WAR file are static files (like images) and which are resource files used by the application.

So, this is created by default, by the App Engine environment, when using the App Engine Maven plugin, so you can handle some specific settings and configurations. You can find more details on these settings here, but it includes the setting of environment variables, how to scale the application - manual, basic or automatic - etc. In addition to that, you can check this example of a sample app that is deployed into war and the file is created as well. Please, bear in mind that this is only on Java 8.

To summarize, this file is created by the App Engine environment when using this plugin, not by a specific function. In this official documentation here, it indicates this as well:

> The artifact you used to create the project has done the basic src/main/webapp/WEB-INF/appengine-web.xml configuration for you

So, this confirms that it was created via the plugin. Besides that, it shows the message of the relation with app.yaml, because they work together and each one of them has a specific use and settings that are needed for your application to work correctly.

Let me know if the information helped you!

答案2

得分: -1

这是App Engine Maven插件的一个非文档化功能,大约两年前已被移除。

https://github.com/GoogleCloudPlatform/app-maven-plugin/issues/426#issuecomment-665757462

英文:

This was a non-documented feature of App Engine Maven Plugin that was removed about two years ago.

https://github.com/GoogleCloudPlatform/app-maven-plugin/issues/426#issuecomment-665757462

huangapple
  • 本文由 发表于 2020年7月29日 06:12:51
  • 转载请务必保留本文链接:https://go.coder-hub.com/63143549.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定