Results 1 to 6 of 6

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

  1. #1
    Join Date
    Feb 2007
    Location
    England
    Posts
    71

    Question 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. #2
    Join Date
    May 2010
    Posts
    398

    Default

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

  3. #3
    Join Date
    May 2010
    Posts
    398

    Default

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

  4. #4
    Join Date
    Feb 2007
    Location
    England
    Posts
    71

    Default

    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

  5. #5
    Join Date
    May 2010
    Posts
    398

    Default

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

  6. #6
    Join Date
    Feb 2007
    Location
    England
    Posts
    71

Posting Permissions

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