gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-03 15:25:27 24 4
gpt4 key购买 nike

我跟进“https://cloud.google.com/tools/cloud-repositories/docs/push-to-deploy”来构建我的第一个测试项目,但是当我执行

“mvn gcloud:deploy”

时,我从 jenkins 控制台收到以下错误:< p>

[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

我的 pom.xml 是:

<?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>

谢谢你们:)

最佳答案

错误说明了一切:

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].

我看到三个选项:

  • 使用 sudo 或以 root 身份运行命令。
  • 使您的 google-cloud-sdk 目录 (/usr/local/share/google/google-cloud-sdk) 对您的用户可写
  • 将 google-cloud-sdk 安装在您的用户具有写入权限的位置并执行如下命令(参见 docs):

    mvn gcloud:run -Dgcloud.gcloud_directory="absolute-path-to-the-gcloud-directory"
  • 将 google-cloud-sdk 安装在您的用户具有写入权限的位置,并在您的 pom.xml 中设置 gcloud 目录(参见 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>
    ...

关于google-app-engine - mvn gcloud :deploy [Error gcloud app command exit code is: 1],我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34390478/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com