Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mvn gcloud:deploy [Error gcloud app command exit code is: 1]

I follow up "https://cloud.google.com/tools/cloud-repositories/docs/push-to-deploy" to build my first test project, but when I do

"mvn gcloud:deploy"

, and I get below errors from jenkins console:
[workspace] $ /opt/bitnami/apps/jenkins/jenkins_home/tools/hudson.tasks.Maven_MavenInstallation/jenkins-maven/bin/mvn clean install gcloud:deploy
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building jenkins-test-java 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ jenkins-test-java ---
[INFO] Deleting /opt/bitnami/apps/jenkins/jenkins_home/jobs/dev-jenkins-test/workspace/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ jenkins-test-java ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /opt/bitnami/apps/jenkins/jenkins_home/jobs/dev-jenkins-test/workspace/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ jenkins-test-java ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ jenkins-test-java ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /opt/bitnami/apps/jenkins/jenkins_home/jobs/dev-jenkins-test/workspace/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ jenkins-test-java ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ jenkins-test-java ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ jenkins-test-java ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: /opt/bitnami/apps/jenkins/jenkins_home/jobs/dev-jenkins-test/workspace/target/jenkins-test-java-1.0-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ jenkins-test-java ---
[INFO] Installing /opt/bitnami/apps/jenkins/jenkins_home/jobs/dev-jenkins-test/workspace/target/jenkins-test-java-1.0-SNAPSHOT.jar to /home/tomcat/.m2/repository/com/google/appengine/demos/jenkins-test-java/1.0-SNAPSHOT/jenkins-test-java-1.0-SNAPSHOT.jar
[INFO] Installing /opt/bitnami/apps/jenkins/jenkins_home/jobs/dev-jenkins-test/workspace/pom.xml to /home/tomcat/.m2/repository/com/google/appengine/demos/jenkins-test-java/1.0-SNAPSHOT/jenkins-test-java-1.0-SNAPSHOT.pom
[INFO] 
[INFO] >>> gcloud-maven-plugin:2.0.9.90.v20151210:deploy (default-cli) > package @ jenkins-test-java >>>
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ jenkins-test-java ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /opt/bitnami/apps/jenkins/jenkins_home/jobs/dev-jenkins-test/workspace/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ jenkins-test-java ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ jenkins-test-java ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /opt/bitnami/apps/jenkins/jenkins_home/jobs/dev-jenkins-test/workspace/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ jenkins-test-java ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ jenkins-test-java ---
[INFO] No tests to run.
[INFO] Skipping execution of surefire because it has already been run for this configuration
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ jenkins-test-java ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] 
[INFO] <<< gcloud-maven-plugin:2.0.9.90.v20151210:deploy (default-cli) < package @ jenkins-test-java <<<
[INFO] 
[INFO] --- gcloud-maven-plugin:2.0.9.90.v20151210:deploy (default-cli) @ jenkins-test-java ---
[INFO] Running gcloud app deploy...
[INFO] Running python -S /usr/local/share/google/google-cloud-sdk/lib/googlecloudsdk/gcloud/gcloud.py --quiet --project=jenkins-test-java preview app deploy /opt/bitnami/apps/jenkins/jenkins_home/jobs/dev-jenkins-test/workspace/target/appengine-staging/app.yaml
[INFO] You do not currently have this command group installed.  Using it 
[INFO] requires the installation of components: [preview]
[INFO] ERROR: (gcloud) You cannot perform this action because you do not have  permission to modify the Google Cloud SDK installation directory    [/usr/local/share/google/google-cloud-sdk].
[INFO] 
[INFO] Re-run the command with sudo: sudo gcloud ...
[ERROR] Error: gcloud app command with exit code : 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.628 s
[INFO] Finished at: 2015-12-21T06:29:47+00:00
[INFO] Final Memory: 11M/56M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.appengine:gcloud-maven- plugin:2.0.9.90.v20151210:deploy (default-cli) on project jenkins-test-java:    Error: gcloud app command exit code is: 1 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please  read the following articles:
[ERROR] [Help 1]      http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Build step 'Invoke top-level Maven targets' marked build as failure
Finished: FAILURE

and my pom.xml is:

<?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>com.google.appengine.demos</groupId>
  <artifactId>jenkins-test-java</artifactId>
  <packaging>jar</packaging>
  <version>1.0-SNAPSHOT</version>
  <properties>
     <appengine.target.version>1.9.28</appengine.target.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>

  <dependencies>
     <!-- Compile/runtime dependencies -->
     <dependency>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-api-1.0-sdk</artifactId>
        <version>${appengine.target.version}</version>
     </dependency>
  </dependencies>

<build>
   <!-- needed for enabling compile/reload on save in mordern IDEs...-->
   <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <version>2.5.1</version>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
           <source>1.7</source>
           <target>1.7</target>
        </configuration>
     </plugin>
     <plugin>
        <groupId>com.google.appengine</groupId>
        <artifactId>gcloud-maven-plugin</artifactId>
        <version>2.0.9.90.v20151210</version>
        <configuration>
           <gcloud_project>jenkins-test-java</gcloud_project>
        </configuration>
     </plugin>
  </plugins>
 </build>
</project>

thank you guys :)

like image 775
JC man Avatar asked Oct 31 '22 12:10

JC man


1 Answers

The error says it all:

ERROR: (gcloud) You cannot perform this action because you do not have permission to modify the Google Cloud SDK installation directory
[/usr/local/share/google/google-cloud-sdk].

I see three options:

  • run the command with sudo or as root.
  • make your google-cloud-sdk directory (/usr/local/share/google/google-cloud-sdk) writeable for your user
  • install the google-cloud-sdk somewhere where your user has write permission and execute the command like (see docs):

    mvn gcloud:run -Dgcloud.gcloud_directory="absolute-path-to-the-gcloud-directory"
    
  • install the google-cloud-sdk somewhere where your user has write permission and set the gcloud directory in your pom.xml (see docs):

    <plugin>
      <groupId>com.google.appengine</groupId>
      <artifactId>gcloud-maven-plugin</artifactId>
      <version>>2.0.9.72.v20150804</version>
      <configuration>
        <gcloud_directory>/usr/foo/private/google-cloud-sdk</gcloud_directory>
        ...
    
like image 146
konqi Avatar answered Nov 08 '22 06:11

konqi