WrapperConfiguration (@Nullable String gradleProjectPath) { Path wrapperPropertiesFile = findDefaultWrapperPropertiesFile(gradleProjectPath); if (wrapperPropertiesFile == null) return null; final WrapperConfiguration wrapperConfiguration = new WrapperConfiguration(); try (Reader wrapperPropertiesReader = Files.newBufferedReader(wrapperPropertiesFile)) { final Properties props = new Properties(); props.load(wrapperPropertiesReader); String distributionUrl = props.getProperty(WrapperExecutor.DISTRIBUTION_URL_PROPERTY); if (isEmpty(distributionUrl)) { throw new ExternalSystemException("Wrapper 'distributionUrl' property does not exist!"); } else { wrapperConfiguration.setDistribution(prepareDistributionUri(distributionUrl, wrapperPropertiesFile)); } String distributionPath = props.getProperty(WrapperExecutor.DISTRIBUTION_PATH_PROPERTY); if (!isEmpty(distributionPath)) { wrapperConfiguration.setDistributionPath(distributionPath); } String distPathBase = props.getProperty(WrapperExecutor.DISTRIBUTION_BASE_PROPERTY); if (!isEmpty(distPathBase)) { wrapperConfiguration.setDistributionBase(distPathBase); } String zipStorePath = props.getProperty(WrapperExecutor.ZIP_STORE_PATH_PROPERTY); if (!isEmpty(zipStorePath)) { wrapperConfiguration.setZipPath(zipStorePath); } String zipStoreBase = props.getProperty(WrapperExecutor.ZIP_STORE_BASE_PROPERTY); if (!isEmpty(zipStoreBase)) { wrapperConfiguration.setZipBase(zipStoreBase); } return wrapperConfiguration; } catch (Exception e) { GradleLog.LOG.warn( String.format("I/O exception on reading gradle wrapper properties file at '%s'", wrapperPropertiesFile.toAbsolutePath()), e); } return null; }