首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >liberty:devc:<dockerfile>未获得荣誉

liberty:devc:<dockerfile>未获得荣誉
EN

Stack Overflow用户
提问于 2021-06-11 06:34:26
回答 1查看 75关注 0票数 1

我观察到<dockerfile>元素,尽管它指向一个有效的Dockerfile,但liberty:devc并不支持它。

考虑mvn help:effective-pom的以下输出

代码语言:javascript
复制
<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>
  <parent>
    <groupId>javaee-cafe</groupId>
    <artifactId>javaee-cafe-parent</artifactId>
    <version>1.0.0</version>
    <relativePath />
  </parent>
  <groupId>javaee-cafe</groupId>
  <artifactId>javaee-cafe-jcache</artifactId>
  <version>1.0.3</version>
  <packaging>war</packaging>
  <name>javaee-cafe-jcache</name>
  <properties>
    <dockerFileName>Dockerfile</dockerFileName>
    <failOnMissingWebXml>false</failOnMissingWebXml>
    <!-- elided -->
    <usrDirectory>/home/edburns/workareas/open-liberty-on-aks/javaee-app-redisson/target/liberty/wlp/usr</usrDirectory>
  </properties>
  <dependencies><!-- elided --></dependencies>
  <build>
    <sourceDirectory>/home/edburns/workareas/open-liberty-on-aks/javaee-app-redisson/src/main/java</sourceDirectory>
    <!-- elided -->
    <resources>
      <resource>
        <filtering>true</filtering>
        <directory>/home/edburns/workareas/open-liberty-on-aks/javaee-app-redisson/src/main/resources</directory>
      </resource>
    </resources>
    <directory>/home/edburns/workareas/open-liberty-on-aks/javaee-app-redisson/target</directory>
    <finalName>javaee-cafe-jcache</finalName>
    <plugins>
      <!-- elided -->
      <plugin>
        <groupId>io.openliberty.tools</groupId>
        <artifactId>liberty-maven-plugin</artifactId>
        <version>3.3.4</version>
        <executions>
          <execution>
            <id>package-server</id>
            <phase>package</phase>
            <goals>
              <goal>create</goal>
              <goal>install-feature</goal>
              <goal>deploy</goal>
            </goals>
            <configuration>
              <container>true</container>
              <dockerfile>/home/edburns/workareas/open-liberty-on-aks/javaee-app-redisson/target/Dockerfile</dockerfile>
              <libertyRuntimeVersion>[21.0.0.5,)</libertyRuntimeVersion>
              <serverXmlFile>/home/edburns/workareas/open-liberty-on-aks/javaee-app-redisson/target/liberty/wlp/usr/servers/defaultServer/server.xml</serverXmlFile>
              <copyDependencies><!-- elided --></copyDependencies>
              <outputDirectory>/home/edburns/workareas/open-liberty-on-aks/javaee-app-redisson/target/wlp-package</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
  </build>
</project>

当我运行mvn liberty:devc时,我看到以下输出:

代码语言:javascript
复制
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< javaee-cafe:javaee-cafe-jcache >-------------------
[INFO] Building javaee-cafe-jcache 1.0.3
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- liberty-maven-plugin:3.3.4:devc (default-cli) @ javaee-cafe-jcache ---
[INFO] CWWKM2102I: Using artifact based assembly archive : io.openliberty:openliberty-kernel:null:21.0.0.5:zip.
[INFO] CWWKM2102I: Using installDirectory : /home/edburns/workareas/open-liberty-on-aks/javaee-app-redisson/target/liberty/wlp.
[INFO] CWWKM2102I: Using serverName : defaultServer.
[INFO] CWWKM2102I: Using serverDirectory : /home/edburns/workareas/open-liberty-on-aks/javaee-app-redisson/target/liberty/wlp/usr/servers/defaultServer.
<!-- elided -->
[INFO] Running liberty:deploy
[INFO] The liberty.runtime.version property value [21.0.0.5,) is used for the runtimeArtifact version.
[INFO] CWWKM2102I: Using artifact based assembly archive : io.openliberty:openliberty-kernel:null:21.0.0.5:zip.
[INFO] CWWKM2102I: Using installDirectory : /home/edburns/workareas/open-liberty-on-aks/javaee-app-redisson/target/liberty/wlp.
[INFO] CWWKM2102I: Using serverName : defaultServer.
[INFO] CWWKM2102I: Using serverDirectory : /home/edburns/workareas/open-liberty-on-aks/javaee-app-redisson/target/liberty/wlp/usr/servers/defaultServer.
[INFO] Copying 1 file to /home/edburns/workareas/open-liberty-on-aks/javaee-app-redisson/target/liberty/wlp/usr/servers/defaultServer
[WARNING] The /home/edburns/workareas/open-liberty-on-aks/javaee-app-redisson/src/main/liberty/config/server.xml file is overwritten by the /home/edburns/workareas/open-liberty-on-aks/javaee-app-redisson/target/liberty/wlp/usr/servers/defaultServer/server.xml file.
[INFO] Copying 1 file to /home/edburns/workareas/open-liberty-on-aks/javaee-app-redisson/target/liberty/wlp/usr/servers/defaultServer
[INFO] CWWKM2144I: Update server configuration file server.xml from /home/edburns/workareas/open-liberty-on-aks/javaee-app-redisson/target/liberty/wlp/usr/servers/defaultServer/server.xml.
[INFO] CWWKM2144I: Update server configuration file bootstrap.properties from inlined configuration.
<!-- elided -->
[INFO] CWWKM2185I: The liberty-maven-plugin configuration parameter "appsDirectory" value defaults to "apps".
[INFO] CWWKM2160I: Installing application javaee-cafe-jcache.war.xml.
[INFO] Parsing the server file /home/edburns/workareas/open-liberty-on-aks/javaee-app-redisson/target/liberty/wlp/usr/servers/defaultServer/server.xml for features and includes.
[INFO] Copying 1 file to /home/edburns/workareas/open-liberty-on-aks/javaee-app-redisson/target/liberty/wlp/usr/servers/defaultServer
[INFO] CWWKM2144I: Update server configuration file server.xml from /home/edburns/workareas/open-liberty-on-aks/javaee-app-redisson/src/main/liberty/config/server.xml.
[INFO] CWWKM2144I: Update server configuration file bootstrap.properties from inlined configuration.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.665 s
[INFO] Finished at: 2021-06-10T18:05:42-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.openliberty.tools:liberty-maven-plugin:3.3.4:devc (default-cli) on project javaee-cafe-jcache: No Dockerfile was found at /home/edburns/workareas/open-liberty-on-aks/javaee-app-redisson/Dockerfile. Create a Dockerfile at the specified location to use dev mode with container support. For an example of how to configure a Dockerfile, see https://github.com/OpenLiberty/ci.docker -> [Help 1]
<!-- elided -->
Compilation exited abnormally with code 1 at Thu Jun 10 18:05:42

看起来<dockerfile>,尽管它存在,但并没有得到尊重。

代码语言:javascript
复制
<dockerfile>/home/edburns/workareas/open-liberty-on-aks/javaee-app-redisson/target/Dockerfile</dockerfile>

这是一个bug吗?

谢谢,

边缘

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-06-11 08:28:45

解决方案:使用插件级别的配置(而不是执行级别)

您需要在插件级别添加配置,而不是在执行级别。

因此,它应该看起来更像:

代码语言:javascript
复制
      <plugin>
        <groupId>io.openliberty.tools</groupId>
        <artifactId>liberty-maven-plugin</artifactId>
        <version>3.3.4</version>
        <configuration>
          <dockerfile>/home/edburns/workareas/open-liberty-on-aks/javaee-app-redisson/target/Dockerfile</dockerfile>
          <!-- ... rest of config ... -->
        </configuration>
      </plugin>

liberty:devliberty:devc目标将生命周期封装在单个目标中,并在循环中迭代执行,但是执行级配置没有这么多用处。(不确定这是否真的有很好的文档记录。)

其他想法

如果你查看我们的示例指南中的pom.xml,比如this one,你会发现我们甚至没有费心去配置其他的特权目标,比如创建,部署,等等,绑定到像package这样的阶段。

我们只需使用liberty:dev和liberty:devc进行迭代开发,然后在构建镜像的时候,我们使用mvn package让maven- WAR -plugin构建war,然后使用Docker构建将WAR构建到应用程序镜像中。

当然,您可能有理由包括这一点,我离题了,但只是在这里添加了一些上下文。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/67929205

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档