java - 如何使用 SNAPSHOT 进行测试以及将 <pluginRepository> 放在哪里?

标签 java google-app-engine maven

我正在尝试运行 https://github.com/GoogleCloudPlatform/appengine-java-vm-hello使用命令 mvn appengine:gcloud_app_run 。 appengine-maven-plugin 使用 gcloud command line tools 。但是,在版本 1.9.15 中,当前存在一个错误,不允许您使用 unix:\\\套接字作为您的$DOCKER_HOST 。一个补丁已经写好了,我被要求测试它;消息如下。

Can you test 1.9.16-SNAPSHOT with

  <pluginRepositories>
    <pluginRepository>
      <id>sonatype-nexus-snapshots</id>
      <name>Sonatype Nexus Snapshots</name>
      <url>https://oss.sonatype.org/content/repositories/google-snapshots/</url>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>always</updatePolicy>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>
?

我确实尝试将 <pluginRepositories>作为 <project> 的直接子级我的水平pom.xml ;它似乎接受了这一点,尽管我在运行 mvn appengine:gcloud_app_run 时仍然有错误:

[INFO] File "/home/stephen/google-cloud-sdk/lib/docker/docker/tls.py", line 41, in init [INFO] 'Path to a certificate and key files must be provided' [INFO] docker.docker.errors.TLSParameterError: Path to a certificate and key files must be provided through the client_config param. TLS configurations should map the Docker CLI client configurations. See http://docs.docker.com/examples/https/ for API details. [ERROR] Error: gcloud app run exit code= 1

然后我尝试更改 <appengine.target.version>1.9.15</appengine.target.version>在我的pom.xml文件至1.9.16-SNAPSHOT ;这次运行时mvn appengine:gcloud_app_run我得到:

[ERROR] Failed to execute goal on project hello: Could not resolve dependencies for project com.google.appengine.demos:hello:war:1.0-SNAPSHOT: Could not find artifact com.google.appengine:appengine-api-1.0-sdk:jar:1.9.16-SNAPSHOT -> [Help 1]

所以,我不知道自己在做什么。具体来说,我不知道如何升级到 SNAPSHOT 也不知道我把这个 <pluginRepositories> 放在哪里事物。如果您可以解决该问题,我真的很感激您的解释或链接到这里发生的事情,因为显然有一些我没有的背景知识。

最佳答案

我通过随机尝试找到了答案。这是我的 pom.xml,更改的部分是包含 <pluginRepository>和字符串 1.9.15更改为1.9.16-SNAPSHOT

<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>
  <packaging>war</packaging>
  <version>1.0-SNAPSHOT</version>

  <groupId>com.google.appengine.demos</groupId>
  <artifactId>hello</artifactId>

  <pluginRepositories>
    <pluginRepository>
      <id>sonatype-nexus-snapshots</id>
      <name>Sonatype Nexus Snapshots</name>
      <url>https://oss.sonatype.org/content/repositories/google-snapshots/</url>
      <snapshots>
        <enabled>true</enabled>
        <updatePolicy>always</updatePolicy>
      </snapshots>
    </pluginRepository>
  </pluginRepositories>

  <properties>
    <appengine.target.version>1.9.15</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>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.5</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <build>
    <outputDirectory>target/${project.artifactId}-${project.version}/WEB-INF/classes</outputDirectory>
    <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>org.apache.maven.plugins</groupId>
        <artifactId>maven-war-plugin</artifactId>
        <version>2.5</version>
        <configuration>
          <archiveClasses>true</archiveClasses>
          <webResources>
            <!-- in order to interpolate version from pom into appengine-web.xml -->
            <resource>
              <directory>${basedir}/src/main/webapp/WEB-INF</directory>
              <filtering>true</filtering>
              <targetPath>WEB-INF</targetPath>
            </resource>
          </webResources>
        </configuration>
      </plugin>

      <plugin>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-maven-plugin</artifactId>
        <version>1.9.16-SNAPSHOT</version>
        <configuration>
        </configuration>
      </plugin>
    </plugins>
  </build>

</project>

关于java - 如何使用 SNAPSHOT 进行测试以及将 <pluginRepository> 放在哪里?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26820637/

相关文章:

java - 如何配置 axis2-java2wsdl-maven-plugin 使用多个类生成一个 wsdl?

java - Android 中准确同步 AudioRecord 和 AudioTrack

google-app-engine - GAE 数据存储 (Golang) : Filter Query When Adding New DB Field

java - Java小程序中的drawImage

Python 日期时间精度

python - Google App Engine、Python、删除 cookie 或更改其值?

java - Tomcat 上下文初始化失败

java - Maven/Hibernate——为什么在 ConstraintViolationException 上出现 NoClassDefFoundError?

java - 是否可以避免 package 和 import 语句?

java - 自动递增数组java