Announcement Announcement Module
Collapse
No announcement yet.
Import project using Gradle wrapper ignores JVM property -Dgradle.user.home Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Import project using Gradle wrapper ignores JVM property -Dgradle.user.home

    On our corporate dev machines our user home directories are size limited thus we have to specify the Gradle home location as system env properties and/or JVM properties. When ever I import a Gradle project and have the workspace preferences for Gradle set to use the Wrapper the gradle user home settings are totally ignored and the Gradle distribution is always downloaded into the .gradle folder in the Windows user home directoty.

    Is this a known issue? Is there a work around?

    Thanks
    Paul

  • #2
    Hi Paul,

    It depends on how you set the property. If you are trying to set the property or arguments as an argument to your Eclipse instance then I would expect this to have *no* effect on the Gradle daemon process. The daemon is a separate process.

    In recent versions of the tools you should be able to set system properties via the Gradle preferences page accessible via menu
    "Window >> Preferences >> Gradle >> Arguments".

    Try adding -Dprop=value arguments to either the JVM or program arguments section.

    Note: there are also similar sections in the Gradle launch configuration editor (accessible via menu "Run >> External Tools >> External Tools Configuration") Settings specified there for individual launc configuration to run Gradle tasks will override the global defaults specified in the preferences page.

    If you are using the preferences page this *should* work. If it does not work then this is a bug and a bug report should be raised.

    Presently, I don't think there is a way to set environment variables yet. If you need this ability you should raise a feature request on our issue tracker https://issuetracker.springsource.com/browse/STS

    Comment


    • #3
      Some more info: the arguments preferences UI was added in 3.0.0.M1
      https://issuetracker.springsource.com/browse/STS-2509

      Just to clarify what I mean by 'recent version' above.

      Comment


      • #4
        Kris,

        Thanks for the reply I tried every way to set the Gradle home and it seems to have no effect on Gradle wrapper when importing the project. The zip file is always extracted to <user.home>.gradle. I did post a comment on the Gradle forums here and the reply seems to suggest you have to specifically tell the tooling API the Gradle home location. Does STS do this? It all works fine if I configure STS to use a Gradle install in a folder and set the Gradle home location as a JVM property in the sts.ini file.

        What do you think?

        Cheers
        Paul

        Comment


        • #5
          Hi Paul,

          Thanks for doing the follow up on the Gradle forum and this forum.

          I was assuming that you could tell gradle about this with a '-D' parameter for which we have already added UI. But it sounds like that won't work and we have to use that specific Gradle tooling API method referred in the forum post.

          I don't believe that STS tooling is using that method at the moment so it seems we end up always using the default.

          To fix this problem, I think we will need to extend the preference page UI and add some widgetry to specify Gradle user home and then pass along that info to that particular method in the tooling API.

          Would you mind raising a feature request for this in our Jira? If you do, I will try to get this feature implemented for the next milestone of STS tooling.

          Kris

          Jira tracker: https://issuetracker.springsource.com/browse/STS

          Comment


          • #6
            Done https://issuetracker.springsource.com/browse/STS-3147

            Comment

            Working...
            X