I'm making Google App Engine project with SpringSource Tool Suite. I made project without maven and added libraries to lib folder and I got Spring Framework work perfectly. But the I tried to make project that uses Maven, adn I when I tried to run my app on development server it cannot find any classes.
So what should I do, so that my dependecies are actually deployed to lib folder?
Example of dependency in pom.xml:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.core</artifactId>
<version>3.0.2.RELEASE</version>
</dependency>
Take a look at the pom.xml in my jappstart project. It's a functional GAE project that uses Spring.
Take a look at the example it covers Sprint 3, Google App Engine and maven.
Related
I have a spring boot app as backend and using react as front end (both are in same project). I only have the one pom file for the backend and I run the spring app manually and then do a npm start on the frontend, all works fine. What I want to do now is deploy both backend and frontend and start them up automatically. Do I need another POM file for the front end or something which will execute npm etc? Front end was created with create-react-app and currently running on port 3000 ( "start": "react-scripts start" ), my backend running on port 8080 but would be deployed to an external tomcat server.
Do I need to add the following plugin:
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
and then some execution rules in the pom?
Any information is much appreciated.
Thanks
If you want to create war in spring boot, you need to add packaging as war and spring-boot-starter-tomcat should be <scope>provided</scope>. I think yes you need to add, please check the reference in the below url,
https://github.com/spring-guides/tut-react-and-spring-data-rest/blob/master/basic/pom.xml
Ref: https://spring.io/guides/tutorials/react-and-spring-data-rest/
<packaging>war</packaging>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
let me chip in and say something else. If you need a war as packaging, you can proceed as per Thangavel said. But I am a bit sceptical to go for a deployment like that on a production site.
Since you are using a front-end framework and spring as backend, I would suggest another way. Usually after doing a build of your front-end, you will use a http server like apache or nginx to deploy your build and then your war or jar for your spring boot project.
But if you want to keep both in the same project, you can do a build of your react project and it should be possible to import those JS files of your build in a thymeleaf or JSP view. Then you would only need to run the project on port 8080.
Here is an example for Angular. I am sure you can look for same in React.
How to include angular2/4 component in JSP page?
Please let me know how it goes.
If you want a good reference implementation you can generate a jhipster project and look at how the frontend plugin is used.
Google has emailed me saying "Migrate your App Engine projects from the legacy SDK (appcfg)" for 3 of my projects. I don't use appcfg, I use mvn to deploy my software. I've 6 projects in total on GAE and have compared the pom files and build files and they are identical. I thought it was because I'm using an older appengine-api, but they are fairly up to date and all use the same version:
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>1.9.58</version>
</dependency>
What I am missing here?
Thanks
Tim
So you basically want to know why would Google send you that email if your projects do not use appcfg?. It could be because:
1.- Just a reminder that you should migrate to the new SDK. If is not specified on the email something like "we have noticed that your project --- is using ..." then is probably just a general reminder.
2.- You have previous versions where you used the legacy SDK, and Google is detecting this.
3.- You are using a deprecated version of Java App Engine SDK-based plugin and have to migrate to the new version (less likely but since you are in fact using Maven wouldn't hurt to check).
Also, i know that you said you weren't using appcfg but here's a list of equivalents commands between appcfg and gcloud for extra information.
I'm currently working on a project and want to use Cypress to write tests for my app that is being made in React. It seems however that Maven is acting up, and after a lot of Google-Fu I got stuck. It seems I'm missing parts of a module, but I was unable to find what kind.Here is an image of said failure.
What am I missing? Thanks in advance.
Missing package maven compiler plugin reports is inside mozilla rhino jar. Try adding following dependency in to your pom.xml
<dependency>
<groupId>org.mozilla</groupId>
<artifactId>rhino</artifactId>
<version>1.7.8</version>
</dependency>
I need to deploy Hello-World application to Google App Engine. I wanna do it through IDEA coz I have Ultimate one. ButI can't find how to do this. Could you please explain me what should I do to deploy, step by step ?
I created project from Idea template, added appengine-web.xml, specified registered app name. Any artifact/WAR hasn't been created yet.
I don't have menu item "Upload App Engine Application" as shown on http://www.jetbrains.com/idea/webhelp/uploading-application-to-google-app-engine.html
My menu->"Tools" is:
Make sure Google App Engine facet and SDK is configured correctly for the application.
You should get this menu then:
The best and easiest way to deploy to Google App Engine is using the Maven plugin.
<!-- The actual maven-gae-plugin. Type "mvn gae:run" to run project, "mvn gae:deploy"
to upload to GAE. -->
<plugin>
<groupId>net.kindleit</groupId>
<artifactId>maven-gae-plugin</artifactId>
<version>0.9.5</version>
</plugin>
If you want to pursue this, then I would be more than happy to help you get it configured up with follow up questions here.
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.