Convert Spring MVC template to GAE - eclipse

Anyone have some template to Transform spring MVC template to run on GAE ?
I already tried different aproaches without success.
Last thing I tried was to add GAE dependency and plugin and criate appengine-web.xml file...
I allways get the message "this project is not a google app engine project"
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>1.9.14</version>
</dependency>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.9.14</version>
</plugin>

Spring and Google App Engine can be made to work together however the structure of a Google App Engine Java Project is very different from the standard Spring or Java Web Project.
If you want to use Maven with Google App Engine I'd suggest copying one of the example/template archetypes and adding the Spring libraries to the project. I've had much greater success with doing it this way. However I have opted not to use Maven with Google App Engine and Spring because the latest version of Spring does not play well with Google App Engine.
The easiest option is to start from a Maven Archetype that contains the key components you want. If you want to progress without Maven you can create a standard Google App Engine project in Eclipse and incorporate the Spring libraries.
Word of warning. Follow the instructions linked below else you'll end up with an application that takes a very long time to start up instances. Due to the way Spring autowires it can take a minute or more for an application to start when deployed to App Engine without correct configuration.
Best of luck!
Read More:
https://cloud.google.com/appengine/docs/java/tools/maven
https://cloud.google.com/appengine/articles/spring_optimization

Related

Why does Eclipse New Maven Project not list Spring Boot Starters?

I have the latest version of Eclipse and am creating a basic Spring Boot Web project.
When I use the New -> ... -> New Maven Project and use the dialog to browse Maven Central for the Spring-Boot-Starter-Web artifact it isn't listed.
Why is Eclipse not listing it?
The configured repository is https://repo1.maven.org/maven2 (Maven Central) which is where Spring-Boot-Starter-Web is meant to reside. (https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web/2.2.4.RELEASE)
I know how to use https://start.spring.io/ to create a spring boot start application so my question is not about how to create one.
What I want to know is what is it about Eclipse, or Maven, that prevents the Spring Boot Starters showing up. I am concerned that there may be plenty of other artefacts that are not visible here and would like to understand the rational for this so I can anticipate what may not be visible.
I appreciate I'm assuming here that a logical reason exists and apologises if it has more to do with how Eclipse feels about things to do with Spring Framework.
You can add in Eclipse from the Help -> Eclipse Marketplace the Spring tools plugin (probably you'll find a newer version of the plugin):
After install it, you'll be able to create a Spring Boot project managing the dependencies at creation time. Select Spring Boot -> Spring Starter Project:
Then you can select which maven dependencies to add:
it lists certain Maven archetype which Spring Boot starters aren't.
It's that simple.
Also, if you have archetypes (e.g. your company makes its own) you can add them to the list of archetypes known to your IDE.

Web App in Eclipse using Mave

I want to develop a Web App in Eclipse using Maven build tool. Where can I find a good tutorial to develop such kind of app?
Thank you.
For your Kind Information There is no big difference between Normal And Maven application. Generally
1.In normal web application we add jars in lib folder in maven in pom.xml
we add maven dependency instead of adding libs
2.The Projects structure is also changed

is maven required to develop spring based project?

I am developing (Single developer) a Spring based project for a Traveling based website.
and this is my first Spring based project, I want to use Maven in my project, because hosting sites like Cloud Bees expecting maven based project for deployment.
Is Maven required to develop Spring based project in Single developer environment.
FYI I am using eclipse IDE.
No it is not required.
You can develop in Spring using Ant or Maven or Gradle etc. or nothing at all.
Although it might be easier to do it with Maven (for library management)
It is not required per se, but you will run into some serious pain down the road if you don't use Maven or Gradle.
The first and foremost reason to use Maven or Gradle is to be able to very simply run tasks that occur ofter (like building a war or running the tests) and to be able to declaratively obtain the required dependencies (which in the case of a typical Spring application are plentiful).
If you are just starting to use build tool, I would suggest you take look at Gradle instead of Maven.

GWT/Grails Project Structure

Does somebody already have some experience embedding gwt in other
client pages except the standard html file?
I want to use gwt as front end and grails as backend. Communication
should be handled over rest json interface so that is loosely coupled.
How do i structure my project at best? Should I create 2 independend
projects or should I stick them together?
At the beginning I had some problems with debugging my gwt application
as it was part of the grails project. Now I copied the compiled js
script to my webapp folder and included it in a grails page. Debugging
gwt in noserver mode worked ok. The problem is , how do I solve my
deployment later at best as I dont want to copy my js everytime by
hand? Already tried the grails gwt plugin but its difficult to debug the gwt application and I even do not want to use the service stuff provided with the plugin.
I thought its a good idea to have 2 maven modules on for grails and one for gwt. Later 2 war files(one grails, one gwt) will deployed on Tomcat, so I also can change gwt client stuff without deploying grails again. How do i manage the brige from grails to gwt best? Just call the standard html in a div from grails page?
I am using maven for building my project.
Thanks for all your help
I have written 2 posts about this topic. In the first one I show Grails+GWT in the same application, using the Grails Gwt Plugin. It appears you already tried that approach. In the second post, I show how to do it with 2 seperate applications, talking JSON between each other using RequestBuilder to request the grails app (that serves JSON responses).
For The deployment in production, you should have Maven doing this job for you.

Unable to publish web app: SpringSource Tool Suite problem?

I have an existing, fully functional Spring web application based on Spring 2.5.6 - developed using SpringSource Tool Suite 2.1.0.SR1.
Because I'd like to use REST I decided to upgrade to Spring 3.0.0.M4. After editing the dependencies in pom.xml and changing my code to reflect the API changes in Spring 3.0 I tried to publish my web app to a local server (SpringSource tc - a Tomcat derivate).
The result is an almost empty web app folder and therefore a non-functional app. The app's folder only contains WEB-INF/lib with all libraries required by the Maven dependencies.
After realising that something's broken, I created a new Spring MVC project (based on the default 2.5.6) and published it to the same server. No problems. I tried to adapt my project's files (.settings/*, .project, .classpath, .springBeans), but this didn't change anything.
I'm pretty lost right now. My guess is that STS doesn't handle 3.0 apps correctly. Any suggestions?
PS: I don't want to revert to 2.5 if it's not absolutely necessary. I don't need STS and tc so I don't have a problem using other tools, but it worked fine so far.
I run into this all the time using Eclipse Galileo and m2eclipse 0.9.8 and Tomcat with WTP. I think it is m2eclipse that is the culprit. The problem seems worse after switching from Ganymede. The work around is to run mvn to create the war and then copy the war contents from "target" to WTP's "wtpwebapps" directory. You can conveniently find this horribly long path by double clicking the server in the Servers view, and choosing "Open Launch Configuration" from there click on Arguments(?) tab I think and copy the catalina.home java property that is defined as an argument there.
The problem vanished with newer versions of STS. Additionally my development environment changed a bit since I posted this question, so I can't really tell what caused the problem.
For me, it looked like a weird hiccup inside STS.
Spring Tool Suite 2.1.0 claims partial support for Spring 3.0, though not for the REST features. According to the release, future releases will add full support. From the release statement:
Features
Support for milestones of Spring 3.0 including XML editing and validation, support for #Configuration and #Bean annotations
Future
Complete Spring 3.0 support including tools for developing RESTful web applications
Try deploying your app to embedded jetty. 'mvn jetty:run' with help you confirm if that there's nothing wrong with your build (that all the right manifests and deps are in place)