if (System.env.ELASTIC_ARTIFACTORY_USERNAME == null || System.env.ELASTIC_ARTIFACTORY_TOKEN == null) { throw new GradleException("Using init script without configuration") } else { logger.info("Using elastic artifactory repos") settingsEvaluated { settings -> settings.pluginManagement { repositories { maven { name "artifactory-gradle-plugins" url "https://artifactory.elstc.co/artifactory/gradle-plugins" credentials { username System.env.ELASTIC_ARTIFACTORY_USERNAME password System.env.ELASTIC_ARTIFACTORY_TOKEN } } gradlePluginPortal() } } } projectsLoaded { allprojects { buildscript { repositories { maven { name "artifactory-gradle-release" url "https://artifactory.elstc.co/artifactory/gradle-release/" credentials { username System.env.ELASTIC_ARTIFACTORY_USERNAME password System.env.ELASTIC_ARTIFACTORY_TOKEN } } } } repositories { maven { name "artifactory-gradle-release" url "https://artifactory.elstc.co/artifactory/gradle-release/" credentials { username System.env.ELASTIC_ARTIFACTORY_USERNAME password System.env.ELASTIC_ARTIFACTORY_TOKEN } } } } } }