Jib -“找不到‘useCurrentTimestamp’”

vic*_*vic 5 jib

我将 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>
Run Code Online (Sandbox Code Playgroud)

运行以下构建命令后,

./mvnw package jib:dockerBuild
Run Code Online (Sandbox Code Playgroud)

我收到以下错误。

[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
Run Code Online (Sandbox Code Playgroud)

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

缺什么?

小智 8

CHANGELOG表明它在 2.0.0useCurrentTimestamp已被弃用并删除:

Removed deprecated <container><useCurrentTimestamp> configuration in favor of <container><creationTime> with USE_CURRENT_TIMESTAMP
Run Code Online (Sandbox Code Playgroud)

看来你需要更换

<useCurrentTimestamp>true</useCurrentTimestamp>
Run Code Online (Sandbox Code Playgroud)

<creationTime>USE_CURRENT_TIMESTAMP</creationTime>
Run Code Online (Sandbox Code Playgroud)