Announcement Announcement Module
Collapse
No announcement yet.
Eclipse Roo project templates Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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 https://issuetracker.springsource.com/browse/STS-95.

    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:

    Code:
    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, 02:56 AM.

    Comment


    • #3
      Ben,

      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.

      Comment


      • #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".

        Comment


        • #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

          Comment


          • #6
            Thomas,

            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.

            HTH

            Christian

            Comment


            • #7
              M2

              when will eclipse update http://www.springsource.org/milestone/e3.4 has the M2 version available ...

              Comment


              • #8
                error

                when trying to execute

                new persistent class jpa -name ~.Hello -testAutomatically


                i get error

                Code:
                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(JdtMarkerResolutionGenerator.java:38)
                at org.eclipse.ui.internal.ide.registry.MarkerHelpRegistry.hasResolution(MarkerHelpRegistry.java:192)
                at org.eclipse.ui.internal.ide.registry.MarkerHelpRegistry.hasResolutions(MarkerHelpRegistry.java:156)
                at org.eclipse.ui.views.markers.MarkerField.annotateImage(MarkerField.java:72)
                at org.eclipse.ui.internal.views.markers.MarkerProblemSeverityAndMessageField.update(MarkerProblemSeverityAndMessageField.java:86)
                at org.eclipse.ui.internal.views.markers.MarkerColumnLabelProvider.update(MarkerColumnLabelProvider.java:62)
                at org.eclipse.jface.viewers.ViewerColumn.refresh(ViewerColumn.java:145)
                at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:932)
                at org.eclipse.jface.viewers.AbstractTreeViewer$UpdateItemSafeRunnable.run(AbstractTreeViewer.java:102)
                at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
                at org.eclipse.core.runtime.Platform.run(Platform.java:880)
                at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
                at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
                at org.eclipse.jface.viewers.AbstractTreeViewer.doUpdateItem(AbstractTreeViewer.java:1012)
                at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run(StructuredViewer.java:466)
                at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
                at org.eclipse.core.runtime.Platform.run(Platform.java:880)
                at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:48)
                at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
                at org.eclipse.jface.viewers.StructuredViewer.updateItem(StructuredViewer.java:2041)
                at org.eclipse.jface.viewers.AbstractTreeViewer.createTreeItem(AbstractTreeViewer.java:827)
                at org.eclipse.jface.viewers.AbstractTreeViewer$1.run(AbstractTreeViewer.java:802)
                at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:70)
                at org.eclipse.jface.viewers.AbstractTreeViewer.createChildren(AbstractTreeViewer.java:776)
                at org.eclipse.jface.viewers.TreeViewer.createChildren(TreeViewer.java:634)
                at org.eclipse.jface.viewers.AbstractTreeViewer.internalExpandToLevel(AbstractTreeViewer.java:1702)
                at org.eclipse.jface.viewers.AbstractTreeViewer.expandToLevel(AbstractTreeViewer.java:1054)
                at org.eclipse.ui.internal.views.markers.MarkersTreeViewer.expandToLevel(MarkersTreeViewer.java:74)
                at org.eclipse.ui.internal.views.markers.ExtendedMarkersView.reexpandCategories(ExtendedMarkersView.java:1509)
                at org.eclipse.ui.internal.views.markers.ExtendedMarkersView$12.runInUIThread(ExtendedMarkersView.java:1302)
                at org.eclipse.ui.progress.UIJob$1.run(UIJob.java:94)
                at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
                at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:133)
                at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3800)
                at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3425)
                at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2384)
                at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2348)
                at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2200)
                at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:495)
                at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:288)
                at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:490)
                at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
                at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:113)
                at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:193)
                at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
                at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
                at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:386)
                at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
                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(Main.java:549)
                at org.eclipse.equinox.launcher.Main.basicRun(Main.java:504)
                at org.eclipse.equinox.launcher.Main.run(Main.java:1236)
                
                eclipse.buildId=M20090211-1700
                java.version=1.6.0_13
                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

                Comment


                • #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 https://issuetracker.springsource.com/browse/STS we would be happy to look into it some more.

                  Comment


                  • #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

                    Comment


                    • #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 http://jira.springframework.org/browse/ROO BTW).

                      Comment


                      • #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

                        Comment


                        • #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).

                          Comment

                          Working...
                          X