Execution default-cli of goal com.google.cloud.tools:appengine-maven-plugin:1.3.2:deploy
failed: Validation Error: Java App Engine components not installed.
Fix by running 'gcloud components install app-engine-java' on command-line.
I already install the latest app-engine-java and google cloud SDK
And i also reinstalled cloud Sdk, that is not working for me.
below is my pom.xml
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<stage.enableJarSplitting>true</stage.enableJarSplitting>
<deploy.stopPreviousVersion>true</deploy.stopPreviousVersion>
<cloudSdkPath>/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk</cloudSdkPath>
</configuration>
As you use Java and App Engine I recommend you to take a look to this official documentation in order to install the required SDK and configure your develop environment with the necessary tools for the purpose of deploy successfully your app.
Let me know how it goes.
Related
I don't have any experience in deployment and trying to deploy Frontend and backend together. I am able to successfully deploy the spring boot application.
I followed this tutorial and successfully generated a build.
Is it possible to deploy the frontend and backend together?
As mentioned in this GCP docs:
Use services in App Engine to factor your large apps into logical
components that can securely share App Engine features and communicate
with one another. Generally, your App Engine services behave like
microservices.
Deploying two apps written in different language on a same runtime in App Engine standard is not possible as you won't be able to run Javascript apps if the current runtime in your app.yaml is Java.
My suggestion would be to split your applications into separate services as mentioned in the docs.
Finally, if you insist on a monolithic approach, consider deploying your app to a custom runtime in App Engine flex. Refer to this doc. Do note that it requires a Dockerfile so you will have to manage the containerization of your apps.
We can deploy a spring boot backend application with react front end as a single JAR in GCP. I simply followed instructions in tutorial , Created an app engine in GCP and ran this command - gcloud app deploy ***.jar
You need to create the jar using maven and then run the command on that jar. It will deploy in gcp.
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<fork>true</fork>
<mainClass>${start-class}</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
Whenever I deploy my app in Google App-engine Flexible, the version is based on the timestamp and each time new version will be created. In appEngine Standard we have:
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>_your_app_id_</application>
<version>alpha-001</version>
<threadsafe>true</threadsafe>
</appengine-web-app>
I need that my app will be deployed always with the same Version name instead of creating new version. How can i do this goal in the same way as Appengine Standard.
If you are using maven with the new google cloud tools maven plugin to deploy your application:
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.plugin.version}</version>
</plugin>
you can define the version into your pom.xml adding the following property:
<properties>
<app.deploy.version>alpha-001</app.deploy.version>
</properties>
If you are using directly the gcloud executable form command line, you can specify the version adding the argument --version like this:
gcloud app deploy --version alpha-001
You can remove the <version> entry from appengine-web.xml.
My java App Engine Managed VMs build doesn't deploy any more using gcloud preview app deploy target/myapp-SNAPSHOT I get this:
ERROR: Found no valid App Engine configuration files in directory
The usage of gcloud preview app deploy changed in our gcloud 2015.04.14 release, you now have to specify the .yaml file for your module as well as --project projectID. The documentation should be updated shortly.
For Java, we've released an updated maven plugin. In your pom.xml, please add the following:
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>gcloud-maven-plugin</artifactId>
<version>0.9.57.v20150425</version>
<configuration>
<gcloud_project>XXX</gcloud_project>
</configuration>
</plugin>
mvn gcloud:deploy
Update to a specific version of the SDK
You have some version of the SDK, but you want to change to a specific non-latest version, add the property:
$ gcloud config set --scope=installation component_manager/fixed_sdk_version 0.9.55
Then run:
$ gcloud components update
Returning to the current version of the SDK
$ gcloud config unset --scope=installation component_manager/fixed_sdk_version
Then run:
$ gcloud components update
I am developing a Google Appengine Java application and I am facing a major challenge testing with the local dev server. I dumped the Eclipse tools cause I'm more flexible with Netbeans and
I am using Appengine Maven plugin for my development.
This is my sample project structure :
myapp
module-endpoints
module-web
module-ear
pom.xml
The application works when I build with mvn clean install on the root folder(myapp) and also when I use the mvn appengine:devserver command to run the module-ear application, however I can't seem to access the cloud endpoints via http://localhost:8080/_ah/api. I can only access the endpoint's API via the dynamically issued port when I access it via the admin console http://localhost:8080/_ah/admin.
The issue with this is that when testing cloud-endpoint Javascript client on the module-web project according to tutorials I am supposed to use localhost:8080/_ah/api as my url to test. Am I missing something?
If the question is still actual you could always update your pom.xml with flags so that the ports of all your modules are defined:
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>${appengine.target.version}</version>
<configuration>
<port>8080</port>
<jvmFlags>
<jvmFlag>-Xdebug</jvmFlag>
<jvmFlag>-Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=n</jvmFlag>
<jvmFlag>-Dcom.google.appengine.devappserver_module.mymodule2.port=9090</jvmFlag>
</jvmFlags>
<disableUpdateCheck>true</disableUpdateCheck>
</configuration>
</plugin>
Then you could use localhost:9090/_ah/api/explorer to test your APIs
If you have several modules deployed, you need to update your maven app engine launcher setup to recognize the different modules. See the modules sample Java app at https://github.com/GoogleCloudPlatform/appengine-modules-sample-java.
If you've already done that, then a dispatch.xml file will tell app engine how to route requests: https://cloud.google.com/appengine/docs/java/modules/routing
It worked when I made the endpoints project the default module.
dispatch.xml is ignored on devserver, the documentation states the following.
Dispatch files
All dispatch files are ignored when running the development server.
The only way to target instances is through their ports.
This means that only the default module will be reachable at the configured port (typically 8888 or 8080). I have just tested it with app engine 1.9.25 and it does not work, so no improvement has been made.
On the other hand you can always refer to the module by its port. The module's location is logged in the console when the application starts, you will see something like:
INFO: Module instance module2-auto is running at http://localhost:37251/
In my case this was useless since I was expecting to make AJAX requests to different modules by using the same host (but different urls). For instance:
Is there a way I can have a Maven compatible Google App Engine (Java) project that is also compatible with the Google Eclipse Plugin inside Eclipse?
Thanks!
EDIT:
Native support for a Maven plugin now:
https://developers.google.com/appengine/docs/java/tools/maven
Depends on what you mean by "compatible" and it depends on what features you're using of GAE plugin. We use the appengine maven plugin http://code.google.com/p/maven-gae-plugin/ and eclipse and they seem to work fine together but we're not using GWT or JDO. As with most things maven/eclipse I find it's best to run your stuff from the command line and just use eclipse as an editor.
I use maven and GAE since one year with JDO with no problems.
Here is my configuration on MacOSX Snow Leopard:
Apache Maven 3.0.3
Eclipse Version: 3.7.1
m2e - Maven Integration for Eclipse 1.0.100.20110804-1717
An important thing to have fully integrated Eclipse with Maven (run all the tests both from command line "mvn test" and from JUnit interface inside Eclipse) is to have the .project file in this way:
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>PROJECT_NAME</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
The plugin has moved here:
https://github.com/maven-gae-plugin/maven-gae-plugin
+1 to Rick's answer, but I'd like to add this:
Google has a tutorial on this: http://code.google.com/p/google-web-toolkit/wiki/WorkingWithMaven
That said, we have never gotten it to work 100%. The maven-gwt-plugin seems to have problems with Eclipse, and it gets worse if you're using RequestFactory due to APT. maven-gae-plugin seems to play nicely. Running from cmdline is much easier. Further, there's a known bug[citation needed] in Eclipse 3.7/m2e that prevents a lot of things from working correctly.
As mentioned google provided support for maven:
https://developers.google.com/appengine/docs/java/tools/maven
But looks it doesn't work fully with Eclipse (as mentioned in one of comments: "SDK location '.m2\repository\com\google\appengine\appengine-api-1.0-sdk\1.7.2\appengine-api-1.0-sdk-1.7.2.jar' is not a directory")
To resolve it I've used maven-eclipse-plugin, and specified containers for GAE/JRE:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<classpathContainers>
<classpathContainer>org.eclipse.jdt.launching.JRE_CONTAINER</classpathContainer>
<classpathContainer>com.google.appengine.eclipse.core.GAE_CONTAINER</classpathContainer>
</classpathContainers>
</configuration>
</plugin>
My general findings about GAE + Maven + Eclipse.
Rule no 1: Use GAE archetype to generate your GAE project: https://developers.google.com/appengine/docs/java/tools/maven
Rule no 2: If you want to develop with Eclipse - don't do "mvn eclipse:eclipse" and then import - it will cause a lot of problems. Instead import as "Maven Project"
Rule no 3: Simple / working solution how to create MVN/GAE/Eclipse project described on YouTube http://www.youtube.com/watch?v=oC6bJp5X3LI
PS. I'm working on project with separate Web/DAO/Domain modules - I will post later my findings and clues.