aspose file tools*
The moose likes Spring and the fly likes How to run Spring/Maven project from Eclipse on a web server (examples from “Spring by Example Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "How to run Spring/Maven project from Eclipse on a web server (examples from “Spring by Example");" Watch "How to run Spring/Maven project from Eclipse on a web server (examples from “Spring by Example");" New topic
Author

How to run Spring/Maven project from Eclipse on a web server (examples from “Spring by Example");

Alex Narinsky
Greenhorn

Joined: Nov 07, 2012
Posts: 9
I downloaded the repository from the book “Spring by Example” by David Winterfeldt
(Version 1.2.1).
Then I successfully ran Maven scripts using Eclipse plugin.
The instruction from the book is: “Right click on project and select 'Run As'/'Run on Server'.”
However, there is no option to 'Run As'/'Run on Server' neither in Eclipse Indigo nor in Spring Tool Suite
Moreover, nether the war file nor war structure are produced using maven scripts
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Alex Narinsky wrote:I downloaded the repository from the book “Spring by Example” by David Winterfeldt
(Version 1.2.1).
Then I successfully ran Maven scripts using Eclipse plugin.
The instruction from the book is: “Right click on project and select 'Run As'/'Run on Server'.”
However, there is no option to 'Run As'/'Run on Server' neither in Eclipse Indigo nor in Spring Tool Suite
Moreover, nether the war file nor war structure are produced using maven scripts


Yes, it is in the right click of a web project. Maybe you have to set the project nature in your STS. Everybody does it all the time. Do you also have Tomcat or web container configured in your STS?

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Alex Narinsky
Greenhorn

Joined: Nov 07, 2012
Posts: 9
Thank you. I added Spring Project Nature through the menu link Spring Nature Tools. The server is already configured in STS – it is VMware vFabric Server Developer Edition. I added Tomcat 7.0.

Still, I do not see the option “Run on Server”. That is in contrast to a Dynamic War Project I just created

How the project is supposed to run – I do not see any war file created?
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17257
    
    6

Alex Narinsky wrote:Thank you. I added Spring Project Nature through the menu link Spring Nature Tools. The server is already configured in STS – it is VMware vFabric Server Developer Edition. I added Tomcat 7.0.

Still, I do not see the option “Run on Server”. That is in contrast to a Dynamic War Project I just created

How the project is supposed to run – I do not see any war file created?


I never did anything. By default if it is a web application with a WEB-INF directory, I just right-click on the project and select Run As - Run on Server. Are you using Maven? then you will have a webapp directory where the WEB-INF directory is. You just have to have a web application project. Nothing special to do.

If you want, you can go to the web container in the servers and choose Add, then select your project, then select the server and run it.

Mark
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1666
    
    7

You said it was a maven web app. So when you imported it into STS did you use file->import->Maven->Existing Maven Projects ? You should use that wizard and then browse to the projects root POM file.

Once you do this you should be able to right click the project choose Run as -> Maven install That will build the project. After that you should see your war file in the target directory in your package explorer.

Also in STS there is no need to install Tomcat. The TC server which comes pre-configured is basically a glorified Tomcat 7. Right clicking your project and selecting Run as -> Run on Server should do the trick. Alternatively double click VMware Vfabric tc Server... in the bottom left server tab. There are three tabs along the bottom of the widow that opens; overview, insight , and modules. Select modules and press the Add Web Module button. If your project is a web app it should show up there and you can add it. Remember to press Ctrl-S or the save button on the top tool bar to save any changes you make.


[How To Ask Questions][Read before you PM me]
Alex Narinsky
Greenhorn

Joined: Nov 07, 2012
Posts: 9
Yes, importing as a Maven project helped. As a result I got more than 40 (!) STS projects, some of them are web projects.
By the way, I feel that working with STS /VMware project is quite slow despite I have a new laptop with Intel-Core 2.50 GHz, 4.00 GB of RAM, and 64 BIT system.
Is it just my impression? Can the speed be improved?
 
 
subject: How to run Spring/Maven project from Eclipse on a web server (examples from “Spring by Example");