Updating GAE cron.xml with maven for an application with Java modules
I have a gae application which is written in java and split into two different modules. One of these modules has a cron.xml that was installed during the initial deployment. The cron tasks are working fine and performing as expected.
Now my problem is that when I redistribute my application using maven (> mvm appengine: update), if I make changes to the cron.xml, those changes will not show up on the server when deployed. I. This is using the old cron.xml.
If I try to update the cron.xml manually (mvn appengine: cron_update), I get an error:
Bad argument: The requested action does not support EAR configurations
Basically my question is, how do I update the cron.xml?
source to share
Try running mvn appengine: cron_update after changing your appengine-maven-plugin from
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.3.2</version>
</plugin>
taken from appengine-maven-plugin git
into this link from Description of Apache-Maven and Appengine
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.9.63</version>
</plugin>
Oh and you may also need to describe your application and version on appengine-web.xml as per this explanation using these tags
<application>_your_app_id_</application><!-- unused for Cloud SDK based tooling -->
<version>alpha-001</version><!-- unused for Cloud SDK based tooling -->
Good luck!
source to share
Run a command mvn appengine:cron_update
( not update_cron as the previous responder suggested) in the folder where yours is pom.xml
.
Here is the relevant section of mine pom.xml
:
<build>
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.9.63</version>
<configuration>
<appId>{PUT YOUR APP ID HERE}</appId>
<version>{PUT YOUR APP VERSION HERE}</version>
</configuration>
</plugin>
And this is what mine looks like cron.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<cronentries>
<cron>
<url>/hello</url>
<description>test cron</description>
<schedule>every 6 hours</schedule>
</cron>
</cronentries>
source to share