public static void setWrappedDistribution(GradleConnector connector, String wrapperPropertyFile) {
    File propertiesFile = new File(wrapperPropertyFile);
    if (propertiesFile.exists()) {
      WrapperExecutor wrapper = WrapperExecutor.forWrapperPropertiesFile(propertiesFile);
      if (wrapper.getDistribution() != null) {
        Distribution distribution = new DistributionFactoryExt().getWrappedDistribution(propertiesFile);
        try {
          setDistributionField(connector, distribution);
        }
        catch (Exception e) {
          ExternalSystemException externalSystemException = new ExternalSystemException(e);
          externalSystemException.initCause(e);
          throw externalSystemException;
        }
      }
    }
  }
public static void setWrappedDistribution(GradleConnector connector, String wrapperPropertyFile)