5

我将 jib 添加到 pom.xml 文件中,如下所示:

<properties>
  <docker.org>springcloudstream</docker.org>
  <docker.version>${project.version}</docker.version>
</properties>
...
<build>
  <plugins>
    <plugin>
      <groupId>com.google.cloud.tools</groupId>
      <artifactId>jib-maven-plugin</artifactId>
      <version>2.1.0</version>
      <configuration>
        <from>
          <image>springcloud/openjdk</image>
        </from>
        <to>
          <image>${docker.org}/${project.artifactId}:${docker.version}</image>
        </to>
        <container>
          <useCurrentTimestamp>true</useCurrentTimestamp>
        </container>
      </configuration>
    </plugin>
  </plugins>
</build>

运行以下构建命令后,

./mvnw package jib:dockerBuild

我收到以下错误。

[ERROR] Failed to execute goal com.google.cloud.tools:jib-maven-plugin:2.1.0:dockerBuild (default-cli) on project usage-detail-sender-kafka: Unable to parse configuration of mojo com.google.cloud.tools:jib-maven-plugin:2.1.0:dockerBuild for parameter useCurrentTimestamp: Cannot find 'useCurrentTimestamp' in class com.google.cloud.tools.jib.maven.JibPluginConfiguration$ContainerParameters

UseCurrentTimestamp 已在配置中。经过网上搜索,我只找到一个条目:https ://github.com/GoogleContainerTools/jib/issues/413 。我在页面上看不到解决方案。

什么不见​​了?

4

1 回答 1

7

CHANGELOG表示在 2.0.0 中useCurrentTimestamp弃用和删除:

Removed deprecated <container><useCurrentTimestamp> configuration in favor of <container><creationTime> with USE_CURRENT_TIMESTAMP

看起来你需要更换

<useCurrentTimestamp>true</useCurrentTimestamp>

<creationTime>USE_CURRENT_TIMESTAMP</creationTime>
于 2020-04-11T20:08:19.927 回答