Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Alex Narinsky
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Alex Narinsky
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Alex Narinsky
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic