首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >运行Java >8映像的fabric8 maven插件配置

运行Java >8映像的fabric8 maven插件配置
EN

Stack Overflow用户
提问于 2018-11-20 21:38:33
回答 2查看 910关注 0票数 3

我正在使用fabric8 maven插件将vertx应用程序部署到Openshift中。我的应用程序正在使用Java 11运行。

但是,默认情况下,fabric8 maven插件使用Java8Docker映像来创建我的vertx应用程序映像。

如何将fabric8 maven插件配置为使用Java11映像?它是否为Java >8提供其他映像?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2019-03-12 16:29:55

我通过将配置添加到生成器中,对Spring应用程序进行了修复。对于vert.x,解决方案可能如下所示:

代码语言:javascript
复制
<plugin>                                                     
    <groupId>io.fabric8</groupId>                            
    <artifactId>fabric8-maven-plugin</artifactId>            
    <version>3.5.42</version>                                
    <configuration>                                          
        <generator>                                          
            <config>                                         
                <vertx>                                      
                    <from>fabric8/s2i-java:3.0-java11</from> 
                </vertx>                                     
            </config>                                        
        </generator>                                         
    </configuration>                                         
</plugin>

可以在Docker页面上查找s2i映像可用的标记:https://hub.docker.com/r/fabric8/s2i-java/tags

票数 3
EN

Stack Overflow用户

发布于 2020-03-24 15:12:04

对我来说,这个解决方案从上面没有帮助,但感谢!我发现我必须在我的个人资料定义中声明图像。我正在运行openshift构建,如下所示:mvn clean fabric8:deploy -P openshift对我有很大帮助,它把这个添加到了概要文件中:

代码语言:javascript
复制
  <properties>
      <fabric8.generator.fromMode>docker</fabric8.generator.fromMode>
      <fabric8.generator.from>fabric8/s2i-java:3.0-java11</fabric8.generator.from>
  </properties>

下面是我的pom.xml的一部分,有一个外观配置文件定义

代码语言:javascript
复制
<properties>
    ...
    <java.version>11</java.version>
    <maven.compiler.plugin.version>3.8.0</maven.compiler.plugin.version>
    <fabric8-maven-plugin.version>4.4.1</fabric8-maven-plugin.version>
  </properties>

  <dependencies>

  ...

  <build>
    <plugins>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>${spring.boot.version}</version>
        <executions>
          <execution>
            <goals>
              <goal>repackage</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>${maven.compiler.plugin.version}</version>
        <configuration>
          <release>${java.version}</release>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>openshift</id>
      <properties>
          <fabric8.generator.fromMode>docker</fabric8.generator.fromMode>
          <fabric8.generator.from>fabric8/s2i-java:3.0-java11</fabric8.generator.from>
      </properties>
      <dependencyManagement>
        <dependencies>
          <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-kubernetes-dependencies</artifactId>
            <version>0.3.0.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
          </dependency>
          <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-dependencies</artifactId>
            <version>Finchley.SR2</version>
            <type>pom</type>
            <scope>import</scope>
          </dependency>
        </dependencies>
      </dependencyManagement>

      <dependencies>
        <dependency>
          <groupId>org.springframework.cloud</groupId>
          <artifactId>spring-cloud-starter-kubernetes-config</artifactId>
        </dependency>
        <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
      </dependencies>

      <build>
        <plugins>       
          <plugin>
            <groupId>io.fabric8</groupId>
            <artifactId>fabric8-maven-plugin</artifactId>
            <version>${fabric8-maven-plugin.version}</version>
            <executions>
              <execution>
                <goals>
                  <goal>resource</goal>
                  <goal>build</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <enricher>
                <config>
                  <f8-healthcheck-vertx>
                    <readiness>
                      <path>/actuator/health</path>
                    </readiness>
                    <liveness>
                      <path>/actuator/health</path>
                    </liveness>
                  </f8-healthcheck-vertx>
                </config>
              </enricher>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53401967

复制
相关文章

相似问题

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