简体   繁体   English

使用哪个App Engine Maven插件?

[英]Which App Engine Maven Plugin to use?

been working with Google App Engine lately and stumbled upon something that is a mystery to me, maybe you can clarify. 最近我一直在使用Google App Engine,偶然发现了一些对我来说很神秘的事情,也许你可以澄清一下。

According to some of Google's own websites ( https://cloud.google.com/appengine/docs/java/tools/maven ) you should use 根据谷歌自己的一些网站( https://cloud.google.com/appengine/docs/java/tools/maven )你应该使用

<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.maven.plugin.version}</version>
</plugin>

and according to some other pages ( https://cloud.google.com/appengine/docs/java/tools/maven-reference ) you should use 并根据其他一些页面( https://cloud.google.com/appengine/docs/java/tools/maven-reference )你应该使用

<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.1.0-beta</version>
</plugin>

Now I am really confused as to which I should use. 现在我真的很困惑我应该使用哪个。 Why are there two versions in the first place? 为什么首先有两个版本?

Problem I am facing: 我面临的问题:

The both seem to support different goals. 两者似乎都支持不同的目标。 One supports deploy etc. and the other one update and update_cron. 一个支持部署等,另一个支持update和update_cron。

I need all 3 of those goals, any way I can have them with one dependecy? 我需要所有这三个目标,无论如何我可以拥有一个依赖目标吗?

Thanks in advance, hope someone can help me with this. 在此先感谢,希望有人可以帮助我。

Sascha 萨沙

<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.maven.plugin.version}</version>
</plugin>

The first one is based on the previous (but not deprecated) appcfg (or Java SDK ). 第一个是基于之前(但未弃用)的appcfg (或Java SDK )。

It offers a lot of Goals specific for App Engine, the basic ones with the dev-server and the deploy, but also for update queues, update cron, update indexes, vacuum indexes, ... 它提供了许多专用于App Engine 的目标 ,基本的是dev-server和deploy,还有更新队列,更新cron,更新索引,真空索引,......

<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.1.0-beta</version>
</plugin>

It's the newest one, still in beta. 这是最新的,仍处于测试阶段。 It is based on GCloud SDK and has a limited set of goals. 它基于GCloud SDK并且具有有限的目标集。

Here you can see the latest version from Maven Central, the latest one is 1.0.0 , I don't see the 1.1.0-beta version 在这里你可以看到Maven Central的最新版本,最新版本是1.0.0 ,我没有看到1.1.0-beta版本

How to choose the proper plugin : If you only need to use dev-server and deploy you can use the newest plugin based on GCloud SDK . 如何选择合适的插件 :如果您只需要使用dev-serverdeploy您可以使用基于GCloud SDK的最新插件。

Those 2 goals are also available in the appcfg based plugin, but if you need more specific goals (like handling queue, cron, indexes, ...) are only available with this last one. 这两个目标也可以在基于appcfg的插件中找到,但如果您需要更多特定目标(如处理队列,cron,索引......),则只能使用最后一个目标。

Also, the Google Cloud Endpoints goals , are only available to the appcfg one 此外, Google Cloud Endpoints目标仅适用于appcfg 目标

At the end, those 2 plugin can coexists in the same project. 最后,这两个插件可以在同一个项目中共存。 The trick to use both of them is using the goal full path instead of the short one ( source ). 使用它们的技巧是使用目标完整路径而不是短路径( )。

For example: 例如:

  • com.google.cloud.tools:appengine-maven-plugin:run
  • com.google.appengine:appengine-maven-plugin:devserver

And not 并不是

  • appengine:run
  • appengine:devserver

If you use the shorter version, Maven is unable to resolve the proper groupId (because the artifactId is the same on both plugins) 如果你使用较短的版本,Maven无法解析正确的groupId(因为artifactId在两个插件上是相同的)

For the moment both plugins are operative and there is not trace of a deprecation about the appcfg based one. 目前这两个插件都是可操作的,并且没有关于基于appcfg的插件的弃用appcfg

Take me for example, I always use the deploy within the GCloud plugin (I consider it slighty better as deploy procedure compared to the appcfg one), but when I need to update cron/queues I use the goal of the previous plugin. 以我为例,我总是在GCloud插件中使用部署(我认为它与appcfg插件程序相比稍微好一点),但是当我需要更新cron / queues时,我使用上一个插件的目标。 I do not have any problem on having both on them inside my project 我在项目中同时使用它们没有任何问题

Remember that if you want to use the GCloud based one, you need to have GCloud installed (and configured) on your local machine. 请记住,如果要使用基于GCloud的GCloud,则需要在本地计算机上安装 (和配置) GCloud

Here is another thread which is discussing the same topic: `gcloud app deploy` vs. `appcfg.py` 这是另一个讨论相同主题的线程: `gcloud app deploy`与`appcfg.py`

The official documentation for both plugins is linked below: 两个插件的官方文档链接如下:

com.google.appengine groupId com.google.appengine groupId

com.google.cloud.tools groupId com.google.cloud.tools groupId

Both plugins are supported, they have the same artifactId ( appengine-maven-plugin ), but different goals and behave differently. 两个插件都受支持,它们具有相同的artifactId( appengine-maven-plugin ),但目标不同,行为也不同。 I think this is another case of bad organization of a software evolution by Google. 我认为这是谷歌软件演变组织不良的另一个案例。 They could simply keep a single plugin and transparently move from one SDK to another by checking their existence in the environment, posting warnings/recommendations etc. 他们可以简单地保留一个插件,并通过检查它们在环境中的存在,发布警告/建议等,从一个SDK透明地移动到另一个SDK。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM