Web App in Eclipse using Mave - eclipse

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

Related

Initial setup of a Spring project

I'm having trouble grasping the correct way of developing a Spring application. I'm following through the tutorial found here: https://spring.io/guides/gs/rest-service/
I understand from reading the instructions that Gradle will download the specified dependencies, but that's only during the build phase. During the development phase, am I supposed to manually download the JAR files and include them as libraries in my Eclipse project?
There are plugins for eclipse that will help you use gradle to develop:
http://gradle.org/tooling
Follow the link here for detailed instructions:
https://github.com/spring-projects/eclipse-integration-gradle/
There's also this. I'm not sure if they are the same plugin:
http://marketplace.eclipse.org/content/gradle-integration-eclipse-44
Manually loading the jars kind of defeats the purpose of using a dependency management tool.
If you want to use an Eclipse-based IDE, you can also use the Spring Tool Suite. It has all the required plugins to develop Spring applications with Gradle or Maven. (http://spring.io/tools/sts)

Maven Eclipse Integration

I have recently started out on Maven. I am trying to integrate Maven+eclipse(Juno)+tomcat7.
I have downloaded m2e-wtp plugin for eclipse and created a Maven project whose structure follows a standard Maven project structure. It is also configured a dynamic web project.
It is a multi module project with two modules of flex(f1 AND f2) and one module of webapp(w).I have configured all the plugins correctly and there is no problem with configuration of POMs.
What I want to achieve is :
When I clean and Build project in Eclipse using Project-->Clean,Eclipse does not build the war in target folder of my web application project (w). I also does not copy any of the flex resources to target folder. However,
When I run the project as maven build by right-clicking the web application project and running it as a "maven install" it creates everything as expected.
My question is that if it is possible to achieve what I mentioned in point (1)? Or the only correct way to do this is the way mentioned in point (2).
I am also not able to deploy the generted files in step 2 automatically in tomcat.
Do I need to use another maven plugin for this?
Please note that this i my first experience with Maven + eclispe. I have followed certain tutorials. So, Please be lenient while voting negatively.
From what I know it is not possible to force Eclipse to use Maven directly (I would gladly be proven wrong).
Eclipse does not use Maven to build (1). Using the m2e plugin, it is possible to run maven to perform the build as you discovered (2).
If you are looking for that kind of tight integration you can look at NetBeans or IntelliJ who are using Maven natively.
EDIT:
About (3) there is a Tomcat-Maven-Plugin that can deploy the WAR file created on a running tomcat instance. Check the Usage page for more details.

Use Maven for dependencies together with GWT Plugin?

So far I'm not using maven for a GWT project. When I deploy it to the GAE Google App Engine, I just have to right click > Google > Deploy to App Engine. Then the war folder is generated automatically and everything runs fine.
If I change the project to maven structure, the menu point in project settings > Google > Web Application tells me: Launch and deploy from this directory (disabled because Maven).
As a result, when deploying, the war folder is not generated/updated!
So: how can I use maven for dependency management, and still use the GWT/GAE Eclipse Plugin to deploy and start my app?
You might want to go through this introductory exercise in maven : http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
What you are describing is possible, but takes some work and understanding of maven to accomplish. If you would like to convert your project to maven, it might take a bit more work than just changing the project to the maven structure in eclipse. An example maven project for App Engine is here : https://github.com/GoogleCloudPlatform/appengine-guestbook-java . Some App Engine specific docs on maven are here : https://developers.google.com/appengine/docs/java/tools/maven

How should I build a GWT application to a WAR file

I have a GWT application that I need to deploy from a WAR file. I've got it kinda working using export to WAR option in Eclipse but after I deploy all of images in the application just show as missing image icon, and besides when we have multiple developers it is not nice to build from IDE this way.
I am looking for if there is a best way to script the build process that people have found (hopefully with an example) such as an Ant xml or any other GWT specific tools?
This tutorial provides step by step instructions for writing an ant script to build the war file including GWT specific compile steps and where/how to package static resources such as images.
http://www.rubiconred.com/blog/build-package-a-gwt-app-to-war-using-ant/
You could look into the GWT maven plugin.
If you're new to GWT or Maven, you might want to first read the GWT documentation and get more familiar with Maven by reading at least its getting started guide or by reading the online reference book.

How to create a swing application using maven?

I was trying to start new swing application using maven,
so I started searching on maven documentation but (frustratingly) found no clue. So I'm asking:
what is the archetype used?
what are the dependencies?
how to build swing app in maven [is there is plugin to do so]?
what is the archetype used?
A swing application is a standard JAR so just use the standard archetype:
mvn archetype:generate -DgroupId=com.mycompany.app \
-DartifactId=myswingapp \
-Dversion=1.0-SNAPSHOT
what are the dependencies?
If you plan to use the standard Swing API only, there aren't no extra dependencies to declare. But if you want to use things like JGoodies, MiGLayout, SwingX, Flamingo, SwingFX etc then you'll have to add the appropriate artifacts and repositories. But there is no universal answer to your question.
how to build swing app in maven [is there is plugin to do so ]?
A Swing app is not really particular. I would maybe just consider using Java Web Start (and the Maven Webstart plugin) or maybe a cross platform installer like IzPack (and the Maven IzPack Plugin). But you have time for that, you need an application before :)
Basically, if you are only using Swing (I mean if you do not want additional features such as SwingX for example), then you will not need to add specific information in your pom.xml file, as everything needed for Swing development is already embedded in the JDK.
Concerning the build process, there is also nothing specific additions here. However, you may need be interesed in:
Creating an executable JAR.
Making a big JAR, that also contains all the dependencies.
Check these links if you have problems finding documentation about maven Better builds with Maven and Maven: The Definitive Guide. Then you will figure out that you can build any kind of app like swing using maven. Maven is not a framework is project management and comprehension tool.
Note: Maven: The Definitive Guide was split into two books. The link goes to the blog post that links to both of them.