Announcement Announcement Module
No announcement yet.
Eclipse Roo project templates Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Eclipse Roo project templates

    I've installed the STS 2.1.0 m1 but can't fintd the Roo project templates when creating a project...

    I've also tries 2.0.2 with the Roo dropin jars but also in this configuration I don't see any Roo project templates.

    Any idea?

  • #2
    In STS 2.1.0.M1, just use New > Project > SpringSource Tool Suite > Template Project.

    You'll then ask asked which template to use. Leave the default as "Roo Simple" and click "Next". You'll then be asked for the project name, and top-level package. A project name might be "hello" and the top-level package "com.springsource.hello". Finally click "Finish".

    If you receive any messages about enabling AJDT weaving service, answer "yes" and then allow it to restart the workbench. This will only happen once.

    I did notice an issue on my (Linux) machine regarding the template. Specifically, you need to go into Project Properties then Java Build Path, Libraries, and "edit" the Apple JVM option and change it to your workspace default JRE. This has been reported against the STS project under

    You can open the Roo shell within STS for your project by right clicking the project and then selecting Spring Tools > Open Roo Shell. You can then enter commands by typing them into the Roo Shell area, or by opening any editor and then hitting CTRL + R at the same time (APPLE + R on an Apple). Your first commands will probably be something like:

    install jpa -database HYPERSONIC_IN_MEMORY -provider HIBERNATE
    new persistent class jpa -name ~.Hello -testAutomatically 
    add field string -fieldName helloWorld -notNull
    run all tests
    new controller automatic -name ~.web.HelloController
    deploy -server "SpringSource dm Server v1.0"
    Next you can visit your application in a browser using something like http://localhost:8080/hello, assuming you called your project "hello" in the initial wizard.

    You can also use "hint" whenever you like for guidance. You don't need to remember all those commands! :-)

    I think it's pretty cool you can build an entire best-practice application like this, run actual tests, and deploy it all without leaving the comfort of STS. You can even make it a deployable WAR for official production deployment by right-clicking the project, then Run as > Maven Package.
    Last edited by Ben Alex; May 14th, 2009, 01:56 AM.


    • #3

      I had a slightly different experience. I could access the template via "New > Other ... > SpringSource Tool Suite > Template Project" but the SpringSource Tool Suite was not listed under "New > Project".

      Also, if I named the project something like "com.springdeveloper.rootest" the project was created but not added to my workspace - i had to import it. Is there a way to controll the root context for the web app so it would be deployed as "rootest" instead of using the full project name?

      The roo version in the created pom vas 1.0.0.A1-SNAPSHOT which I did not have in my maven repo - so changing that to 1.0.0.A2 worked since that's the version that the Roo readme.txt file specified to use when adding the jar to local Maven repo.

      Am I running a slightly outdated roo plugin? I'm using what came with STS 2.1.0.M1.


      • #4
        From both Java and Java EE perspective I don't see SpringSource Tool Suite when starting the project wizard from File > New > Project...

        However when using ctrl + n then the SpringSource Tool Suite branch is available, and I can choose the Roo Template.

        Am I just doing something wrong or is this a bug?

        Originally posted by Ben Alex View Post
        In STS 2.1.0.M1, just use New > Project > SpringSource Tool Suite > Template Project.

        You'll then ask asked which template to use. Leave the default as "Roo Simple" and click "Next". You'll then be asked for the project name, and top-level package. A project name might be "hello" and the top-level package "com.springsource.hello". Finally click "Finish".


        • #5
          From both Java and Java EE perspective I don't see SpringSource Tool Suite when starting the project wizard from File > New > Project...
          Try File > New > Other... and SpringSource Tool Suite should be listed there - same as the ctrl-N shortcut


          • #6

            thanks for raising the issue here. I fixed the project template to not include a Mac-specific JVM and use the latest M2 roo-annotations in the pom.xml.

            Also the project wizards (New Spring Project and New Template Project) are now available from File -> New -> Project...

            With upcoming 2.1.0.M2 you will also not able to enter a project name with a '.' as this is going to confuse the template: the project name is used throughout the Spring XML configs, e.g. servletName and URL mappings. '.' don't make a lot of sense there.




            • #7

              when will eclipse update has the M2 version available ...


              • #8

                when trying to execute

                new persistent class jpa -name ~.Hello -testAutomatically

                i get error

                java.lang.StringIndexOutOfBoundsException: String index out of range: -2
                at java.lang.String.substring(Unknown Source)
                at com.springsource.sts.server.quickfix.jdt.JdtMarkerResolutionGenerator.getResolutions(
                at org.eclipse.ui.internal.ide.registry.MarkerHelpRegistry.hasResolution(
                at org.eclipse.ui.internal.ide.registry.MarkerHelpRegistry.hasResolutions(
                at org.eclipse.ui.views.markers.MarkerField.annotateImage(
                at org.eclipse.ui.internal.views.markers.MarkerProblemSeverityAndMessageField.update(
                at org.eclipse.ui.internal.views.markers.MarkerColumnLabelProvider.update(
                at org.eclipse.jface.viewers.ViewerColumn.refresh(
                at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(
                at org.eclipse.jface.viewers.AbstractTreeViewer$
                at org.eclipse.ui.internal.JFaceUtil$
                at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(
                at org.eclipse.jface.viewers.StructuredViewer$
                at org.eclipse.ui.internal.JFaceUtil$
                at org.eclipse.jface.viewers.StructuredViewer.updateItem(
                at org.eclipse.jface.viewers.AbstractTreeViewer.createTreeItem(
                at org.eclipse.jface.viewers.AbstractTreeViewer$
                at org.eclipse.swt.custom.BusyIndicator.showWhile(
                at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren(
                at org.eclipse.jface.viewers.TreeViewer.createChildren(
                at org.eclipse.jface.viewers.AbstractTreeViewer.internalExpandToLevel(
                at org.eclipse.jface.viewers.AbstractTreeViewer.expandToLevel(
                at org.eclipse.ui.internal.views.markers.MarkersTreeViewer.expandToLevel(
                at org.eclipse.ui.internal.views.markers.ExtendedMarkersView.reexpandCategories(
                at org.eclipse.ui.internal.views.markers.ExtendedMarkersView$12.runInUIThread(
                at org.eclipse.ui.progress.UIJob$
                at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(
                at org.eclipse.swt.widgets.Display.runAsyncMessages(
                at org.eclipse.swt.widgets.Display.readAndDispatch(
                at org.eclipse.ui.internal.Workbench.runEventLoop(
                at org.eclipse.ui.internal.Workbench.runUI(
                at org.eclipse.ui.internal.Workbench.access$4(
                at org.eclipse.ui.internal.Workbench$
                at org.eclipse.core.databinding.observable.Realm.runWithDefault(
                at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(
                at org.eclipse.ui.PlatformUI.createAndRunWorkbench(
                at org.eclipse.ui.internal.ide.application.IDEApplication.start(
                at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(
                at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at org.eclipse.equinox.launcher.Main.invokeFramework(
                at org.eclipse.equinox.launcher.Main.basicRun(
                java.vendor=Sun Microsystems Inc.
                BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
                Command-line arguments:  -os win32 -ws win32 -arch x86


                • #9
                  The Roo command you have used looks fine to me.

                  The exception stack trace is showing an issue within the STS/Eclipse IDE. Can you reproduce this, or was it a one-off? If you cannot reproduce, it could be that the file was still being written out by Roo at the same time as STS/Eclipse started to parse it (ie before the content was fully formed).

                  If you'd like to log a bug report against STS at we would be happy to look into it some more.


                  • #10

                    seem to be ok today after i re-generate

                    just one point want to hight-light.

                    the file applicationContext.xml generate some making the file showing some error. after delete all the . it's ok. by the way, i working on windows machine


                    • #11
                      Can you please expand on what is wrong with the application context on Windows? If it's a Roo issue we are keen to fix it for you (the Roo issue tracker is at BTW).


                      • #12

                        thank you for prompt response Ben. I will issue in the tracker. let me gather the details first. by the way, can anyone tell me where i can download jar file with this class javax.validation.constraints.NotNull ? one of the file need this


                        • #13
                          When you create a Roo project and then use JSR 303 arguments for the first time in field creation commands, the POM will automatically be updated to include the JSR 303 annotation library. As such you shouldn't need to specify it manually. Nonetheless, the library added is:

                          Group ID: javax.validation
                          Artifact: com.springsource.javax.validation
                          Version: 1.0.0.CR1
                          Note the above are the SpringSource Enterprise Bundle Repository names, which is what Roo uses by default (as we can ensure such JARs are properly versioned, have valid POMs and OSGi manifests etc).