Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: Trouble importing grails project into STS 2.5.1

  1. #1
    Join Date
    Nov 2009
    Posts
    9

    Default 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.
    Attached Images Attached Images
    Last edited by zenmonkey; Dec 19th, 2010 at 09:41 PM.

  2. #2
    Join Date
    May 2009
    Location
    Vancouver
    Posts
    274

    Default

    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

  3. #3
    Join Date
    Nov 2009
    Posts
    9

    Default

    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.

  4. #4
    Join Date
    May 2009
    Location
    Vancouver
    Posts
    274

    Default

    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

  5. #5
    Join Date
    May 2009
    Location
    Vancouver
    Posts
    274

    Default

    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

  6. #6
    Join Date
    Nov 2009
    Posts
    9

    Default

    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.

  7. #7
    Join Date
    May 2010
    Posts
    398

    Default

    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 (kdvolder@vmware.com). I won't share it with anyone, just use it to test / debug the importing of projects into STS.

    Kris
    Kris De Volder -- SpringSource

  8. #8
    Join Date
    Nov 2009
    Posts
    9

    Default

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

  9. #9
    Join Date
    May 2010
    Posts
    398

    Default

    Cool! Thanks for letting us know.
    Kris De Volder -- SpringSource

  10. #10

    Default 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.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •