'Failed to deploy Google APP Engine Java /Maven

I'm trying to deploy my java/Maven application on Google Cloud App Engine, but without success I'm getting the following error:

[ERROR] Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:2.4.2:deploy (default-cli) on project reembolso: Execution default-cli of goal com.google.cloud.tools:appengine-maven-plugin:2.4.2:deploy failed: com.googl e.cloud.tools.appengine.operations.cloudsdk.AppEngineJavaComponentsNotInstalledException: Validation Error: Java App Engine components not installed. Fix by running 'gcloud components install app-engine-java' on command-line. -> [He lp 1]

The pom file is configured like this:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>br.com.teste</groupId>
    <artifactId>reembolso</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>

    <name>reembolso</name>
    <description>Aplicação</description>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.4.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>

        <appengine.sdk.version>1.9.63</appengine.sdk.version>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>

        <failOnMissingWebXml>false</failOnMissingWebXml> <!-- REQUIRED -->

        <appengine.maven.plugin>2.4.2</appengine.maven.plugin>
        <jetty>9.4.44.v20210927</jetty>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>

       

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-cache</artifactId>
        </dependency>

        <dependency>
            <groupId>net.sf.ehcache</groupId>
            <artifactId>ehcache</artifactId>
            <version>2.9.0</version>
        </dependency>

        <dependency>
            <groupId>javax.cache</groupId>
            <artifactId>cache-api</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>3.1.0</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jul-to-slf4j</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>5.1.46</version>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-jpamodelgen</artifactId>
        </dependency>

        <dependency>
            <groupId>org.modelmapper</groupId>
            <artifactId>modelmapper</artifactId>
            <version>2.0.0</version>
        </dependency>

        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.0</version>
        </dependency>

        <dependency>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-api-1.0-sdk</artifactId>
            <version>${appengine.sdk.version}</version>
        </dependency>

        <dependency>
            <groupId>com.google.api-client</groupId>
            <artifactId>google-api-client</artifactId>
            <version>1.30.3</version>
        </dependency>

        <!-- Google Admin do G Suite -->
        <dependency>
            <groupId>com.google.apis</groupId>
            <artifactId>google-api-services-admin-directory</artifactId>
            <version>directory_v1-rev104-1.25.0</version>
        </dependency>

        <!-- Google Cloud Storage -->
        <dependency>
            <groupId>com.google.cloud</groupId>
            <artifactId>google-cloud-storage</artifactId>
            <version>1.85.0</version>
        </dependency>

        <!-- Google Gmail -->
        <dependency>
            <groupId>com.google.apis</groupId>
            <artifactId>google-api-services-gmail</artifactId>
            <version>v1-rev105-1.25.0</version>
        </dependency>
    </dependencies>
    <profiles>
        <profile>
            <id>run-test</id>
            <properties>
                <tests.skip>true</tests.skip>
            </properties>
        </profile>

    </profiles>

    <build>
        <!-- for hot reload of the web application -->
        <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
        <plugins>

            <plugin>
                <groupId>com.google.cloud.tools</groupId>
                <artifactId>appengine-maven-plugin</artifactId>
                <version>2.4.2</version>
                <configuration>
                    <stage.enableJarSplitting>true</stage.enableJarSplitting>
                    <deploy.stopPreviousVersion>true</deploy.stopPreviousVersion>
                    <cloudSdkHome>/usr/foo/path/to/cloudsdk</cloudSdkHome>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.eclipse.jetty</groupId>
                <artifactId>jetty-maven-plugin</artifactId>
                <version>${jetty}</version>
            </plugin>

        </plugins>
    </build>
<!--    <build>-->
<!--        <plugins>-->
<!--            <plugin>-->
<!--                <groupId>org.springframework.boot</groupId>-->
<!--                <artifactId>spring-boot-maven-plugin</artifactId>-->
<!--            </plugin>-->

<!--            &lt;!&ndash;configuração para execução local&ndash;&gt;-->
<!--            <plugin>-->
<!--                <groupId>com.google.cloud.tools</groupId>-->
<!--                <artifactId>appengine-maven-plugin</artifactId>-->
<!--                <version>2.4.0</version>-->
<!--                <configuration>-->
<!--                    <skipTests>$(tests.skip)</skipTests>-->
<!--                </configuration>-->
<!--            </plugin>-->
<!--            <plugin>-->
<!--                <groupId>org.eclipse.jetty</groupId>-->
<!--                <artifactId>jetty-maven-plugin</artifactId>-->
<!--                <version>9.3.7.v20160115</version>-->
<!--            </plugin>-->
<!--        </plugins>-->
<!--    </build>-->

</project>


Solution 1:[1]

If you are on Windows, running gcloud components install as an administrator may work: GoogleCloudPlatform/app-maven-plugin#393 (comment)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Jovani