Announcement Announcement Module
No announcement yet.
Gradle Integration Plugin - NullPointerException Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Gradle Integration Plugin - NullPointerException

    Hi there,
    I'm trying to convert some of the projects to Gradle and during this process I'm getting NullPointerException on all existing Eclipse projects. It happens with both, Juno and Indigo releases.

    !ENTRY org.springsource.ide.eclipse.gradle.core 4 0 2013-01-07 19:23:07.374
    !STACK 0
            at org.springsource.ide.eclipse.gradle.core.util.NatureUtils.ensure(
            at org.springsource.ide.eclipse.gradle.core.GradleProject.convertToGradleProject(
            at org.springsource.ide.eclipse.gradle.ui.actions.ConvertToGradleProjectActionDelegate$1.doit(
            at org.springsource.ide.eclipse.gradle.core.util.GradleRunnable$
    I did verify that metadata contains required Java nature.

    <?xml version="1.0" encoding="UTF-8"?>
    Even in cases when I don't have FindBugs nature, I'm still getting NullPointerException. The interesting thing is that I'm able to convert any newly Java projects into Gradle type of projects. After careful comparison I cannot find material difference between new and existing projects though.

    Any ideas?

  • #2
    NPE by default to me are to be considered bugs. They simply shouldn't be happening.

    So this looks like a bug in STS Gradle tools. I have raised a bug report on the issue tracker:

    I couldn't fill in the 'affects version' field because you didn't say in the post what version of the gradle STS plugin you are using.

    I'll look into it a little bit based on the stacktrace. Further info will be added to the issue in the tracker if I find anything interesting.


    • #3
      I can't reproduce. But I did add some comments to the bug report.

      This is a bit of a guess so may be wrong, but perhaps it has something to do with how your existing project's location is being defined in terms of path variables.

      I'm not sure how, as a user, you can actually create projects that have their location defined in terms of path variables. But it is possible, I think, for plugins to create projects who's 'location' isn't defined as an absolute location but a path relative to a path variable. If this path variable then goes missing from the workspace, then Eclipse will have trouble computing the location for the project.

      This might explain why you don't have problems with new projects.

      Some places to look for information that may help us diagnose:

      1) Windows >> Preferences >> General >> Workspace >> Linked Resources
      There's a table here with the path variables defined in your workspace.

      2) Project context menu go to: "Properties >> Resource".
      There it displays the 'location' of the project. Maybe it shows something interesting there.
      Also under "Properties >> REsource >> Linked Resources" take look at the info in the two tabs there. Maybe something looks off.

      Not sure this will help. But its worth a try.

      Something else you can try is importing the projects into a new workspace. It is possible that whatever that may be 'off' with the project or workspace is fixed by doing that. Though it would be more satisfying to determine what's wrong than make the problem go away without knowing what caused it.

      Another question. What kinds of projects are they, did they get created / imported with a specific plugin? Maven tools, whatever?

      I'm bit fishing for info here, not really sure what is going on.



      • #4
        Hi Kris,
        Here's the version I'm using:
        I'm checking on your latter post - I know that we have some paths defined with macros. I'll get back to you shortly on that.
        As for the projects themselves, I have no information on how they were originally created. I think it was plain vanilla new project flow. I have imported them into my workspace from code repository. The projects are currently built with Ant scripts.


        • #5
          Hi Kris,
          I have verified the configuration:
          1) Linked Resources table is empty
          2) Properties-Resources has something interesting in it indeed! I have changed my Unix home directory from Andrey to andrey some time ago and all entries, except PROJECT_LOC reflect the change. PROJECT_LOC still using old home name. Apparently, I cannot change it in Eclipse, let me re-import the project and check if it helps.


          • #6
            Hi Kris,
            That was it - after importing projects into new workspace all functionality works as expected. I was able to convert the projects to Gradle.
            I would like to thank you for quick and detailed response, I really appreciate that!


            • #7
              Are you on Mac OS by any chance?

              If so then I think I know what happened. You changed 'Andrey' to 'andrey'. To Mac OS this is the same thing as its filesystem is case insensitive. However I think the code in Gradle tooling would have problems matching a projects location spelled with capitals to the same location spelled with lower case.

              I think this would explain that much of the Eclipse functionality still works fine, since the files where really still in the same place. But some 'equals' tests in the tools would fail unexpectedly and illogically... and this ultimately caused an NPE.

              Anyhow... thanks for letting me know your problem is solved :-)



              • #8
                Hi Kris,
                Yes, I'm on Mac OS.