问题
been working with Google App Engine lately and stumbled upon something that is a mystery to me, maybe you can clarify.
According to some of Google's own websites (https://cloud.google.com/appengine/docs/java/tools/maven) you should use
<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
<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.
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
回答1:
<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
).
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, ...
<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.
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
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
.
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.
Also, the Google Cloud Endpoints goals, are only available to the appcfg
one
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)
For the moment both plugins are operative and there is not trace of a deprecation about the appcfg
based one.
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. 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.
Here is another thread which is discussing the same topic: `gcloud app deploy` vs. `appcfg.py`
回答2:
The official documentation for both plugins is linked below:
com.google.appengine groupId
com.google.cloud.tools groupId
Both plugins are supported, they have the same artifactId (appengine-maven-plugin
), but different goals and behave differently. 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.
来源:https://stackoverflow.com/questions/40627278/which-app-engine-maven-plugin-to-use