2

I am using the buildship plugin to build gradle projects. I need to use some env variables in my build script to connect to some external repositories. When i run the gradle build from command line, it works fine as I have the required env variables. I would like to run the build from eclipse.

I do not see an Environment tab in the run configuration window. How do i set env variables for gradle build in eclipse?

Here is where i need the env variables

repositories {
    mavenCentral()
    maven {
            def mvnRpoUrl = "https://some/url/1"
            url mvnRpoUrl

            credentials {
                username "$System.env.USER_ID1"
                password "$System.env.PASSWORD1"
            }
     }
     maven {
            def mvnRpoUrl = "https://some/other/url"
            url mvnRpoUrl

            credentials {
                username "$System.env.USER_ID2"
                password "$System.env.PASSWORD2"
        }
    }
}
AbtPst
  • 7,778
  • 17
  • 91
  • 172
  • Depends on what do you want those for. Add details. – LMC Jun 14 '18 at 16:04
  • please see the edit – AbtPst Jun 14 '18 at 17:47
  • [This](https://stackoverflow.com/a/12751665/2834978) seems to be the answer. – LMC Jun 14 '18 at 17:51
  • umm, not sure as i dont want to modify the properties file. since this project will be shared by others, it makes sense to use env variables – AbtPst Jun 14 '18 at 18:00
  • 1
    That file is for each user, please double check the path: `~/.gradle/gradle.properties`. `~` is an alias for `$HOME`, and `.gradle` is a hidden directory. That file will not be added to distributed files. – LMC Jun 14 '18 at 18:09

0 Answers0