Announcement Announcement Module
Collapse
No announcement yet.
Deploy a Roo project within STS Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Deploy a Roo project within STS

    Hi all,

    I am using Roo on a Spring project. I use STS 2.2.

    My question is how can I deploy the project on a Server within the IDE? I can use mvn tomcat:run to launch the project in tomcat but when I tried the petclinic example app it can be deployed on the Spring tc Server....

    What do I have missed?

  • #2
    Hi

    Have you tried "perform eclipse" before importing your project into STS?? It generates all metadata files for a standard eclipse WTP project.

    HTH

    Comment


    • #3
      I did not import the project into eclipse I started it directly within STS.

      Comment


      • #4
        It's a normal web project, so you can drag-and-drop it onto a local server instance or use Run As -> Run on Server. In addition to that, the STS shell offers a 'deploy' command that will let you choose a local server instance to deploy to.

        Comment


        • #5
          The point is that I cannot drag into the server. Using the petclinic example I can but not with my project. Why?

          I created a Spring project in STS and then activated Roo feature... Should I have done something else?

          Comment


          • #6
            A new Roo project is not a web project yet: you first need to add controllers to turn it into a web project that can be deployed to a local server. Otherwise it's just a regular Java project.

            Comment


            • #7
              I added controllers with the command controller all

              Comment


              • #8
                Hi,

                STS does include a new project wizard for Roo projects: File > New > Roo project. It seems you have not done this but instead added the Roo project nature to an existing project. While this will give you access to the Roo shell in your project it does not imply that your project magically becomes a web project .

                So my first question is, does your own project follow the directory and configuration file naming conventions that Roo expects? Second, if you open the project pom.xml file and see if the project packaging is set to war:

                Code:
                <packaging>war</packaging>
                If so, you can run mvn eclipse:eclipse from your project directory to generate/update the necessary Eclipse workspace config files that mark this project as a Web project. Once that is done, refresh your project in STS and you will find that you can now drag it to any Web container (tcServer, tomcat, dmServer, etc).

                HTH,
                Stefan

                Comment


                • #9
                  Fyi, I've had better luck using STS to "import maven project" w/o using mvn eclipse:eclipse at all. (I have not tried with recent Roo or the latest STS, but I had what felt like random problems any time I used mvn eclipse:eclipse on a Roo project.)

                  Two advantages of using File->Import -> Maven Project:

                  1) Spring maven dependencies are set up to be managed by the pom rather than being imported into a static eclipse library

                  2) I had to remove and re-add AspectJ support to get my projects to recognize the aspects after using mvn eclipse:eclipse - otherwise I had bunches of build errors.

                  3) The "create roo project" template within STS uses the Roo version that shipped with that version of STS, rather than using the (newer) version of Roo that I have on my classpath. So I find it more consistent to create the project outside of STS and then import it as a Maven project.

                  Don't know if this is a recommended approach or not, but it has worked better for me.

                  Comment


                  • #10
                    Originally posted by Stefan Schmidt View Post
                    Hi,

                    STS does include a new project wizard for Roo projects: File > New > Roo project. It seems you have not done this but instead added the Roo project nature to an existing project. While this will give you access to the Roo shell in your project it does not imply that your project magically becomes a web project .
                    Excuse my ignorance I did a New -> Spring Project and then added the Roo nature thinking that it would suffice to make it a web project.

                    I performed the mvn eclipse:eclipse and everything is working now, thanks!

                    Comment


                    • #11
                      Originally posted by Stefan Schmidt View Post
                      Hi,

                      STS does include a new project wizard for Roo projects: File > New > Roo project. It seems you have not done this but instead added the Roo project nature to an existing project. While this will give you access to the Roo shell in your project it does not imply that your project magically becomes a web project .

                      So my first question is, does your own project follow the directory and configuration file naming conventions that Roo expects? Second, if you open the project pom.xml file and see if the project packaging is set to war:

                      Code:
                      <packaging>war</packaging>
                      If so, you can run mvn eclipse:eclipse from your project directory to generate/update the necessary Eclipse workspace config files that mark this project as a Web project. Once that is done, refresh your project in STS and you will find that you can now drag it to any Web container (tcServer, tomcat, dmServer, etc).

                      HTH,
                      Stefan
                      Stefan,

                      I am having the same issue described here, but my project does contain the packaging tags in the pom.xml file (below).

                      Code:
                      <packaging>war</packaging>
                      However, I am still unable to deploy it using the server which is part of STS.

                      I think I am missing a step when creating the project as a "web" project rather than simply a roo spring project. Can you point me in the right direction on how to properly setup a web project using roo?

                      Comment


                      • #12
                        Originally posted by mikej View Post
                        Fyi, I've had better luck using STS to "import maven project" w/o using mvn eclipse:eclipse at all. (I have not tried with recent Roo or the latest STS, but I had what felt like random problems any time I used mvn eclipse:eclipse on a Roo project.)
                        On the contrary, I use mvn eclipse:clean eclipse:eclipse all the time to get projects that are acting up — typically when after a application crash — working again. That and a clean rebuild and starting up STS with "-clean" on the first line of the STS.ini file.
                        Originally posted by mikej View Post
                        1) Spring maven dependencies are set up to be managed by the pom rather than being imported into a static eclipse library
                        This is not so for me, at least not in STS 2.7 and later. I don't remember it from 2.3 either.
                        Originally posted by mikej View Post
                        2) I had to remove and re-add AspectJ support to get my projects to recognize the aspects after using mvn eclipse:eclipse - otherwise I had bunches of build errors.
                        That figures. This have never happened to me. And I've had loads of other problems with STS.
                        Originally posted by mikej View Post
                        3) The "create roo project" template within STS uses the Roo version that shipped with that version of STS, rather than using the (newer) version of Roo that I have on my classpath. So I find it more consistent to create the project outside of STS and then import it as a Maven project.
                        You can change the Roo version used in the preferences. You have explored the preferences and project properties, have you not? Some versions of Roo have been incompatible with later versions of STS, but usually this have been fixed at the Release stage.

                        Anyway, besides a long standing bug that causes Roo projects to intermittently be created as a jdk6 project even when all settings are for jdk5, it have seldom mattered where I've created a Roo project.

                        This all said, my biggest problem are with Spring Roo projects that are put into an unstable state because of crashes and these take a lot of effort to repair these effectively. It's getting better, but the instability is still there. On the other hand I've been pushing it with Roo 1.2 nightlies, though I doubt that nor my aging jdk1.5 that is the sole cause of this. But that's another story.

                        Considering I'm running STS 2.9M1 on a Dual G5 from 2005 with 8gb ram and jdk1.5 in OS X 10.5.8, why are you using such an old version of STS? Is this a deliberate choice not to upgrade and what have you gained from it? I'm curious.

                        Comment


                        • #13
                          Is there some way to deploy to an external Tomcat server from within STS? Preferably via SSH.

                          Comment


                          • #14
                            mp257784, use web mvc setup

                            Read the Roo 1.2 manual in the docs and the smoke will clear right out.

                            Comment


                            • #15
                              Perhaps not. I've run through each of the samples mentioned on the getting started page both from the roo shell without eclipse and also within eclipse using STS.

                              In each instance, every example fails with various errors. I've read the docs as well and frankly they give conflicting information. The docs do not match the commands given in the samples as some have been deprecated.

                              I'm sure roo works but following the docs doesn't do it.

                              Comment

                              Working...
                              X