Announcement Announcement Module
Collapse
No announcement yet.
Missing GrailsDependencies? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Missing GrailsDependencies?

    Suddenly on one development machine I find that all of my Grails Dependencies are missing--which causes no end of problems of course. A clean followed by a Refresh Dependencies still fails to locate the basic Grails Dependencies in classpath.

    What I see in the IDE Project Explorer is "Grails Dependencies [2.0.1] (uninitialized). When I look at the Java Build Path Libraries I see non of the libraries needed to build a Grails application (e.g svnkit-1.3.5.jar or json-simple-1.1.jar)

    My BuildConfig.groovy looks the same as a working development environment--both have 'inherits("global")' in what seems to be the proper place.

    So what did I break? I even downloaded the entire project from GitHub again and imported it--still the same problem.

    [update]
    A test project has the proper defalt classpath for Grails Dependencies. So the question becomes what file holds the list of the Grails Dependencies?
    Last edited by MikeTempleman; Apr 6th, 2012, 04:45 PM.

  • #2
    Hi Mike,

    That is odd. Something seems to be going wrong when refreshing the dependencies. Is there any kind of error in the error log that seems connected?

    You can open the error log view from menu "Windows >> Show View >> Error log".

    Try doing another "refresh dependencies" and see if any new errors appear in there. Hopefully there will be some error giving us a clue on what the problem might be.

    Kris

    Comment


    • #3
      Hi Kris

      It is very odd. I nuked the workspace directory. My project was not imported into the workspace so I should not have lost anything. This didn't help at all, but now I am getting errors as the workspace is being recreated. The error log shows:

      An internal error occurred during: "Refreshing workspace".

      java.lang.IllegalArgumentException: Element not found: /.org.eclipse.jdt.core.external.folders/.link2/dsld.
      at org.eclipse.core.internal.watson.ElementTree.eleme ntNotFound(ElementTree.java:256)
      at org.eclipse.core.internal.watson.ElementTree.creat eElement(ElementTree.java:184)
      at org.eclipse.core.internal.resources.Workspace.crea teResource(Workspace.java:1369)
      at org.eclipse.core.internal.resources.Workspace.crea teResource(Workspace.java:1322)
      at org.eclipse.core.internal.localstore.RefreshLocalV isitor.createResource(RefreshLocalVisitor.java:80)
      at org.eclipse.core.internal.localstore.RefreshLocalA liasVisitor.createResource(RefreshLocalAliasVisito r.java:38)
      at org.eclipse.core.internal.localstore.RefreshLocalV isitor.synchronizeExistence(RefreshLocalVisitor.ja va:219)
      at org.eclipse.core.internal.localstore.RefreshLocalV isitor.visit(RefreshLocalVisitor.java:293)
      at org.eclipse.core.internal.localstore.UnifiedTree.a ccept(UnifiedTree.java:110)
      at org.eclipse.core.internal.localstore.FileSystemRes ourceManager.refreshResource(FileSystemResourceMan ager.java:920)
      at org.eclipse.core.internal.localstore.FileSystemRes ourceManager.refresh(FileSystemResourceManager.jav a:904)
      at org.eclipse.core.internal.resources.Resource.refre shLocal(Resource.java:1663)
      at org.eclipse.core.internal.refresh.RefreshJob.runIn Workspace(RefreshJob.java:167)
      at org.eclipse.core.internal.resources.InternalWorksp aceJob.run(InternalWorkspaceJob.java:38)
      at org.eclipse.core.internal.jobs.Worker.run(Worker.j ava:54)
      The prior error received at the same time is:
      java.lang.IllegalArgumentException: Element not found: /.org.eclipse.jdt.core.external.folders/.link2/dsld.
      A hint might be that creating a dummy test project in the same environment does manage to initialize the Grails Dependencies.

      My environment is:

      eclipse.buildId=2.9.1.201203221000-RELEASE
      java.version=1.6.0_23
      java.vendor=Sun Microsystems Inc.
      BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
      Framework arguments: -product com.springsource.sts.ide
      Command-line arguments: -os linux -ws gtk -arch x86 -product com.springsource.sts.ide

      I am running Open JDK 6 on Ubuntu 11.10 under Sun VirtualBox with 1.5GB RAM and a single processor allocated.

      Comment


      • #4
        I'm still at a loss what may be going on for you. The error you saw could be connected but it seems unlikely.

        > My project was not imported into the workspace

        Do you mean the project is linked to an external location? (It must be imported or otherwise you can't work with it in STS). If so, event though your project itself is not physically stored in the workspace on disk, I think there is still some content, particularly related to DSL support that may be linked into your workspaces metadata.

        If you want to try a 'clean start' I'd recommend doing the following instead of 'nuking' your workspace.

        - open STS on a new/empty workspace
        - import the project into the workspace with the the 'import existing project' import wizard. (optionally, create a copy or zip up your project for safekeeping first).

        If it still doesn't work... see what errors you find in the error log and report them.

        I would be most interested in the error that happens exactly during the time window when you run 'refresh dependencies'.

        Kris

        PS: The error you saw has something to do with Groovy Eclipse's DSL support... and it is not completely impossible that because an error in refreshing that DSL content the dependencies didn't show. Did this error show when you did refresh dependencies? Or at some other point in time? I have seen the error before, but it seems mostly harmless and temporary (and somewhat random and hard to reproduce and fix unfortunately).

        Comment


        • #5
          OK.

          I created a new workspace and imported the entire project into that workspace (rather than letting it have its own folders outside the workspace for source). Upon building, I still see:

          Grails Dependencies [Grails 2.0.1] (uninitialized) with only dslsupport found in the list viewed in the Project Explorer
          I get a compile error (undefined class) for one of my classes (SearchTerm) with a stack dump of over 300 entries (!!??)
          I view any of my packages and look at the package statement on line 1 I see the following marker:
          Multiple markers at this line
          - The type groovy.lang.GroovyObject cannot be resolved. It is indirectly referenced from
          required .class files
          - The type groovy.lang.MetaClass cannot be resolved. It is indirectly referenced from
          required .class files
          The Markers window tell me that:

          The project was not built since its build path is incomplete. Cannot find the class file for groovy.lang.GroovyObject. Fix the build path then try building this project plover Unknown Java Problem
          and

          Description Resource Path Location Type
          The type groovy.lang.GroovyObject cannot be resolved. It is indirectly referenced from required .class files ProcessInstanceEventInfoDomainController.groovy /plover/grails-app/controllers/org/drools/gorm/session line 1 Java Problem
          There were several errors in the Error Log. One interesting one was:

          A handler conflict occurred. This may disable some commands.

          Conflict for 'org.eclipse.jdt.ui.edit.text.java.refactor.quickM enu':
          HandlerActivation(commandId=org.eclipse.jdt.ui.edi t.text.java.refactor.quickMenu,
          handler=org.eclipse.jdt.internal.ui.actions.JDTQui ckMenuCreator$1@9ebd53,
          expression=AndExpression(ActivePartExpression(org. eclipse.ui.navigator.resources.ProjectExplorer@44e 906),WorkbenchWindowExpression(org.eclipse.ui.inte rnal.WorkbenchWindow@1fbe226)),sourcePriority=1064 960)
          HandlerActivation(commandId=org.eclipse.jdt.ui.edi t.text.java.refactor.quickMenu,
          handler=org.eclipse.jdt.internal.ui.actions.JDTQui ckMenuCreator$1@19f9db1,
          expression=AndExpression(ActivePartExpression(org. eclipse.ui.navigator.resources.ProjectExplorer@44e 906),WorkbenchWindowExpression(org.eclipse.ui.inte rnal.WorkbenchWindow@1fbe226)),sourcePriority=1064 960)
          I have recovered all my source changes and incorporated them into another git repo. I am inclined to trash everything and pull down that new git repo at this point. I am a horrible newbie at this IDE and, as you know, no one can screw things up better than a newbie.

          If this doesn't tell you what you need to know, then why don't we write this off as a newbie problem. I will watch to see if it recurs again and post a new thread (referring to this thread) if it does.

          OK?

          Thank you very, very much for trying to help.

          Comment


          • #6
            I'd rather not 'put it down to a newbee problem'. It doesn't really matter whether you are a newbee or not. We should try to figure out some way what's going on and get you up and running.

            We are getting a little closer.

            > I get a compile error (undefined class) for one of my classes (SearchTerm) with a stack dump of over 300 entries (!!??)

            This likely the cause of all your problems. I.e. if the command "grails compile" fails, then STS will not have the dependency data. This data is produced as a side effect of the compile command. So it doesn't get generated if the compile fails.

            The next three errors/markers that you mention are all because of the missing dependencies (i.e. the stuff STS needs to compile your code is missing from the classpath and that all leads to these messages).

            The final error that you mention is inocuous and it is caused by two different Eclipse plugins trying to bind a different command to the same keyboard shortcut.

            To fix your problem you will need to figure out why "grails compile" is not finding that SearchTerm class. Once the compile error(s) is/are fixed the dependencies should appear and then things will start to look a lot better in STS.

            Kris

            PS: You could try re-pulling your code from git, but if the compile error isn't solved by that (which it probably wouldn't be) then that won't help much.

            Comment


            • #7
              Just a little extra info. What may be confusing here is that there are essentially two compiles going on.

              First "Refresh Dependencies" does an external "grails compile". As a side effect of this grails creates the "Grails Dependencies" info.
              Then there is a compile inside the IDE. This needs the info from the first compile to know its classpath.

              So to be clear, in your case the first compile seems to be failing.
              => dependency data is missing
              => lots of compile errors on the second compile inside the IDE.

              Normally, once you are up and running, the 'first compile' is not happening unless you explicitly trigger it by doing "Grails Tools >> Refresh Dependencies". But if there is already a compile error on first import you will get the problem that you are now having.

              Kris

              Comment


              • #8
                That was the problem. I rabbit-holed down the classpath issue not realizing that it was due to the failure to locate a local symbol. Once I refreshed from the upstream repo the problem went away.

                Thanks!

                Comment


                • #9
                  Great! I'm glad it got sorted out.

                  Comment

                  Working...
                  X