Search in sources :

Example 1 with CloudSdkVersionFileException

use of com.google.cloud.tools.appengine.cloudsdk.CloudSdkVersionFileException in project app-maven-plugin by GoogleCloudPlatform.

the class CloudSdkAppEngineFactory method defaultCloudSdkBuilder.

protected CloudSdk.Builder defaultCloudSdkBuilder() {
    mojo.handleCloudSdkPathDeprecation();
    Path sdkPath = mojo.getCloudSdkHome();
    if (mojo.getCloudSdkHome() == null) {
        sdkPath = cloudSdkOperationsFactory.newDownloader(mojo.getCloudSdkVersion()).downloadCloudSdk(mojo.getLog());
    }
    CloudSdk.Builder cloudSdkBuilder = cloudSdkFactory.cloudSdkBuilder().sdkPath(sdkPath);
    if (mojo.getCloudSdkHome() != null && mojo.getCloudSdkVersion() != null) {
        try {
            cloudSdkOperationsFactory.newChecker(mojo.getCloudSdkVersion()).checkCloudSdk(cloudSdkBuilder.build());
        } catch (CloudSdkNotFoundException | CloudSdkVersionFileException | InvalidJavaSdkException | AppEngineJavaComponentsNotInstalledException | CloudSdkOutOfDateException ex) {
            throw new RuntimeException(ex);
        }
    }
    ProcessOutputLineListener lineListener = new DefaultProcessOutputLineListener(mojo.getLog());
    return cloudSdkBuilder.addStdOutLineListener(lineListener).addStdErrLineListener(lineListener).exitListener(new NonZeroExceptionExitListener()).appCommandMetricsEnvironment(mojo.getArtifactId()).appCommandMetricsEnvironmentVersion(mojo.getArtifactVersion()).appCommandCredentialFile(mojo.getServiceAccountKeyFile());
}
Also used : Path(java.nio.file.Path) CloudSdkOutOfDateException(com.google.cloud.tools.appengine.cloudsdk.CloudSdkOutOfDateException) CloudSdkNotFoundException(com.google.cloud.tools.appengine.cloudsdk.CloudSdkNotFoundException) AppEngineJavaComponentsNotInstalledException(com.google.cloud.tools.appengine.cloudsdk.AppEngineJavaComponentsNotInstalledException) NonZeroExceptionExitListener(com.google.cloud.tools.appengine.cloudsdk.process.NonZeroExceptionExitListener) CloudSdkVersionFileException(com.google.cloud.tools.appengine.cloudsdk.CloudSdkVersionFileException) ProcessOutputLineListener(com.google.cloud.tools.appengine.cloudsdk.process.ProcessOutputLineListener) CloudSdk(com.google.cloud.tools.appengine.cloudsdk.CloudSdk) InvalidJavaSdkException(com.google.cloud.tools.appengine.cloudsdk.InvalidJavaSdkException)

Aggregations

AppEngineJavaComponentsNotInstalledException (com.google.cloud.tools.appengine.cloudsdk.AppEngineJavaComponentsNotInstalledException)1 CloudSdk (com.google.cloud.tools.appengine.cloudsdk.CloudSdk)1 CloudSdkNotFoundException (com.google.cloud.tools.appengine.cloudsdk.CloudSdkNotFoundException)1 CloudSdkOutOfDateException (com.google.cloud.tools.appengine.cloudsdk.CloudSdkOutOfDateException)1 CloudSdkVersionFileException (com.google.cloud.tools.appengine.cloudsdk.CloudSdkVersionFileException)1 InvalidJavaSdkException (com.google.cloud.tools.appengine.cloudsdk.InvalidJavaSdkException)1 NonZeroExceptionExitListener (com.google.cloud.tools.appengine.cloudsdk.process.NonZeroExceptionExitListener)1 ProcessOutputLineListener (com.google.cloud.tools.appengine.cloudsdk.process.ProcessOutputLineListener)1 Path (java.nio.file.Path)1