Proper multienvironment build configuration

(Pavel Fischer) #1

Hello forum,

we currently migrate our project from ant to gradle. The problem, what we currently have is the fact, that the code should be able to compile on at least 3 different environments ( local, jenkins and a production-like test environment), but every environment has own firewall restrictions (e.g. no internet access at all). Therefore we have some problems.

  1. As we use wrapper for build, the URL for gradle distribution is configured via properties and dev-value is committed in git-repo. On a test-env there is no internet access and local nexus url is different from jenkis nexus (where devs has access), so the build doesn’t work. Our current workaround is to update this url via shell script. Better way would be probably to install gradle on this environment a call gradle wrapper before build. Is there any better way?

  2. Changing of repositories URL for dependencies was not a problem. But how can the URL for gradle plugins repository be changed? As we can’t simply write url in buildscript or in pluginRepositories blocks, I see only the possibility with env-specific property file with url, but gradle (3.2) don’t see the values from it in the settings.gradle…

Thank you for advice,

(Dimitar Dimitrov) #2

Hi Pavel, I am working in an environment where we have many of your constraints.

A year ago, I created some slides that capture many of the patterns and problems we’ve discovered - have a look here (the description of the setup starts at slide 30)

(Pavel Fischer) #3

Thank you for the Information.
In the end, I come with an additional jenkins job, which generate property file and rerun gradle wrapper