Announcement Announcement Module
Collapse
No announcement yet.
Trouble importing grails project into STS 2.5.1 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Trouble importing grails project into STS 2.5.1

    I am using STS Version: 2.5.1, Build Id: 201011111000

    I am unable to build an imported grails project in STS. Basically during the import process it's not able to initialize the grails runtime. Please take a look at the attached screenshots.

    I can confirm that in the buildpath, there are no jars under "Grails Dependencies".

    Under the problems view, two relevant messages are:
    1. The project was not built since its build path is incomplete. Cannot find class file for groovy.lang.GroovyObject
    2. The type groovy.lang.GroovyObject cannot be resolved. It is indirectly referenced from required .class files

    Not sure why this is happening. Is there a quick way to fix this problem other than manually adding the grails jars to the build path?

    Thanks.
    Last edited by zenmonkey; Dec 19th, 2010, 09:41 PM.

  • #2
    Hello,

    Do you have a grails installation defined? Having the groovy and grails tools installed into STS is one thing, but they need a version of the grails framework in order to operate correctly - they don't come with one by default (various reasons), but typically someone with grails projects in existence will already have one installed somewhere on their machine, STS just needs to know where. Under https://issuetracker.springsource.com/browse/STS-1419 we are looking to improve the situation where the user hasn't got one defined, since there aren't enough clues in the UI. We have also got some improvements coming in STS 2.5.2 that should smooth the import process.

    The recently updated tutorial at http://www.grails.org/STS+Integration# may be a useful reference for you.

    As for your situation. Open the grails installations settings dialog (Window>Preferences>Groovy>Grails) and in the right hand side define the location of your grails install. If you don't have one you can point it at, you can choose to install the one we offer from the STS update site (on the dashboard extensions page, select 'Grails (current production release)' under 'Languages and Frameworks' - as described in the tutorial I linked above). This will currently give you 1.3.5 I think - if your project is 1.3.6 you may want to grab 1.3.6 from the grails website, install it on your machine then tell STS where it is.

    Once defined, a quick refresh dependencies should fix things up (Alt+G,R).

    Now, if you do already have a grails install defined and yet it is still misbehaving, let us know.

    cheers
    Andy
    ---
    Andy Clement
    SpringSource

    Comment


    • #3
      Andy,

      Sorry I didn't mention this but I do have grails installed defined (1.3.6).

      I've been using STS successfully for the past few months on new grails projects created in STS. This particular problem happens when I try to import an existing grails project that was created outside of STS.

      Two quick FYIs:
      1: I imported the project according to the "Importing via the New Grails Project Wizard" section in the http://www.grails.org/STS+Integration# tutorial.

      2: I also ran "grails --integrate-with eclipse" just to make sure the eclipse files are generated correctly. But that didn't fix the problem either.

      Comment


      • #4
        Hi,

        You don't need to run (2) as the files will have been generated OK by 1.3.6. Actually there is a bug I keep forgetting we've fixed, related to whether you choose to copy the actual project into eclipse or not when you import it. Which are you doing, keeping it outside? (that is when it can fail)

        Can you try picking up this fix by updating to a recent nightly build of the grails tools? Update site for nightly is: http://dist.springsource.com/snapsho...S/nightly/e3.6

        We are almost at STS 2.5.2 (within days), I hope there isn't something incompatible with 2.5.1 on that update site - maybe try it in a test STS first rather than damaging your main one?

        cheers
        Andy

        Comment


        • #5
          If you didn't want to risk installing, there are workarounds mentioned in the Jira (
          https://issuetracker.springsource.com/browse/STS-1347 ) that you could try

          "Workaround: refresh dependencies and then disable and re-enable dependency management makes compile errors go away. It forces JDT to flush its cached resolved classpath."

          cheers
          Andy

          Comment


          • #6
            I am keeping it outside.

            I will try the nightly build and see if that fixes it.

            Btw the other workaround (refresh dependencies and then disable and re-enable dependency management) didn't seem to work.

            Comment


            • #7
              Hi Zenmonkey,

              I'm the one who worked on those "improvements" Andy mentions, that will be in 2.5.2.

              So naturally I'd be interested to make sure these improvements would actually fix the problems you are having. Would you mind sharing the project you are having so much trouble importing?

              If it isn't possible to post it in a public forum, maybe you could send it to me privately ([email protected]). I won't share it with anyone, just use it to test / debug the importing of projects into STS.

              Kris

              Comment


              • #8
                I took the update and that did the trick. Thanks guys!

                Comment


                • #9
                  Cool! Thanks for letting us know.

                  Comment


                  • #10
                    Similar problems

                    I am opening a project in STS 2.5.2.CI-R6391-B206 which is developed in STS 2.5.1 and got similar problems,i.e.

                    1. The project was not built since its build path is incomplete. Cannot find class file for groovy.lang.GroovyObject
                    2. The type groovy.lang.GroovyObject cannot be resolved. It is indirectly referenced from required .class files

                    I am also getting numerous red errors markers in the source code files. Also the plugin manager not showing anything where as I have installed two plugins spring-security-core and spring-security-openid. I can run my app by 'grails run-app', but its the editor that is causing problems.

                    Comment


                    • #11
                      The error you are getting indicates some kind of problem initializing the "Grails classpath container". This is how STS configures the internal Groovy compiler's classpath.

                      All of the other problems are most likely a result of the classpath container problem.

                      The question is... why is the classpath container broken? We have to figure that out.

                      Can you try doing "Grails Tools >> Refresh Dependencies". This will force an update of the classpath container. In the version you have, errors from that operation will only get logged in the error log (I only yesterday put in a little fix that will make errors from the refresh dependcies popup in a message box shown to the users, which may hopefully help in the future to know when/why something isn't working).

                      So after trying that can you check the error log (Go to "Window >> Show View >> Other >> Error Log") and see if there are any errors? Post what you find here.

                      Comment


                      • #12
                        Also, make sure you have a Grails install configured in your workspace, you probably did this already, but I just wanted to make sure :-)

                        Go to "Window >> Preferences >> Grails" and make sure you have a version of Grails configured there that matches the version in your project's "application.properties".

                        Comment


                        • #13
                          Hi my grails versions are okay - 1.3.6, I have double checked those. This is what I got in the error log after trying 'Grails tools -> Refresh dependencies':


                          Code:
                          org.eclipse.core.runtime.CoreException: Command failed, see details for output.
                          at com.springsource.sts.grails.core.launch.SynchLaunch$LaunchResult.getCoreException(SynchLaunch.java:150)
                          at com.springsource.sts.grails.core.launch.SynchLaunch.synchExec(SynchLaunch.java:51)
                          at com.springsource.sts.grails.commands.GrailsCommand.synchExec(GrailsCommand.java:154)
                          at com.springsource.sts.grails.commands.GrailsCommand.synchExec(GrailsCommand.java:112)
                          at com.springsource.sts.grails.commands.GrailsCommandUtils.refreshDependencies(GrailsCommandUtils.java:318)
                          at com.springsource.sts.grails.core.internal.classpath.GrailsClasspathContainerUpdateJob.runInWorkspace(GrailsClasspathContainerUpdateJob.java:74)
                          at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
                          at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
                          Contains: ------System.out:-----------
                          
                          Contains: ------System.err:-----------

                          This is what I got after executing 'Grails Tools -> Grails Plugin Manager':

                          Code:
                          org.eclipse.core.runtime.CoreException: Command failed, see details for output.
                          at com.springsource.sts.grails.core.launch.SynchLaunch$LaunchResult.getCoreException(SynchLaunch.java:150)
                          at com.springsource.sts.grails.core.launch.SynchLaunch.synchExec(SynchLaunch.java:51)
                          at com.springsource.sts.grails.commands.GrailsCommand.synchExec(GrailsCommand.java:154)
                          at com.springsource.sts.grails.commands.GrailsCommand.synchExec(GrailsCommand.java:112)
                          at com.springsource.sts.grails.core.internal.classpath.GrailsPluginsListManager.generateList(GrailsPluginsListManager.java:212)
                          at com.springsource.sts.grails.ui.internal.dialogues.GrailsPluginManagerDialogue$5.run(GrailsPluginManagerDialogue.java:809)
                          at com.springsource.sts.grails.ui.internal.tasks.SynchUITask$1.run(SynchUITask.java:66)
                          at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:121)
                          Contains: ------System.out:-----------
                          
                          Contains: ------System.err:-----------

                          Code:
                          Unable to find or generate plugins list in: null
                          An exception stack trace is not available.

                          Comment


                          • #14
                            Hmm... I haven't seen something like that exactly before.

                            The error output in both cases showed that Grails commands didn't really execute. Otherwise there would be some output under "System.out". If there's some problem executing grails commands in your setup, naturally none of the grails stuff will work.

                            Note that having a grails install configured in your workspace is different than having it installed on your hard drive. (You probably knew that, just making sure :-)

                            All I can think is maybe the install you have configured is pointing to an invalid location, or a location which for some reason causes problems. To make absolutely sure it is a valid install, can you go to Windows >> Preferences >> Grails and configure it again. If it is already there, just add a new one, point it to your grails install directory, and then delete the old one. I just want to make sure that you haven't accidentally got some old configuration of a Grails install that points to a no longer valid location on your hard drive.

                            Also, can you post the exact path where your Grails install lives (sometimes if it is an unusual location, this can trigger latent bugs that otherwise don't happen).

                            Kris
                            Last edited by Kris De Volder; Dec 23rd, 2010, 01:14 PM.

                            Comment


                            • #15
                              Hi, My problems are fixed after looking into this thread - http://forum.springsource.org/showthread.php?t=82361 and this issues - https://issuetracker.springsource.com/browse/STS-796. I wonder why this issue is still unresolved?

                              Comment

                              Working...
                              X