Results 1 to 8 of 8

Thread: Gradle Integration Plugin - NullPointerException

Hybrid View

  1. #1
    Join Date
    Jan 2013
    Posts
    11

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

    Code:
    !ENTRY org.springsource.ide.eclipse.gradle.core 4 0 2013-01-07 19:23:07.374
    !MESSAGE 
    !STACK 0
    java.lang.NullPointerException
            at org.springsource.ide.eclipse.gradle.core.util.NatureUtils.ensure(NatureUtils.java:32)
            at org.springsource.ide.eclipse.gradle.core.GradleProject.convertToGradleProject(GradleProject.java:659)
            at org.springsource.ide.eclipse.gradle.ui.actions.ConvertToGradleProjectActionDelegate$1.doit(ConvertToGradleProjectActionDelegate.java:54)
            at org.springsource.ide.eclipse.gradle.core.util.GradleRunnable$1.run(GradleRunnable.java:50)
            at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
    I did verify that metadata contains required Java nature.

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <projectDescription>
            <name>util</name>
            <comment></comment>
            <projects>
            </projects>
            <buildSpec>
                    <buildCommand>
                            <name>org.eclipse.jdt.core.javabuilder</name>
                            <arguments>
                            </arguments>
                    </buildCommand>
                    <buildCommand>
                            <name>edu.umd.cs.findbugs.plugin.eclipse.findbugsBuilder</name>
                            <arguments>
                            </arguments>
                    </buildCommand>
            </buildSpec>
            <natures>
                    <nature>org.eclipse.jdt.core.javanature</nature>
                    <nature>edu.umd.cs.findbugs.plugin.eclipse.findbugsNature</nature>
            </natures>
    </projectDescription>
    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. #2
    Join Date
    May 2010
    Posts
    398

    Default

    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:
    https://issuetracker.springsource.com/browse/STS-3146

    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.
    Kris De Volder -- SpringSource

  3. #3
    Join Date
    May 2010
    Posts
    398

    Default

    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.

    Kris
    Kris De Volder -- SpringSource

  4. #4
    Join Date
    Jan 2013
    Posts
    11

    Default

    Hi Kris,
    Here's the version I'm using: 3.1.0.201210040512-RELEASE
    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.
    Andrey

  5. #5
    Join Date
    Jan 2013
    Posts
    11

    Default

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

  6. #6
    Join Date
    Jan 2013
    Posts
    11

    Default

    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!
    Andrey

Posting Permissions

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