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



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

然而,默认情况下,fabric8 maven插件使用Java 8 Docker映像来创建我的vertx应用程序映像。

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

我通过将配置中的添加到生成器中,为我的Spring Boot应用程序修复了它。对于vert.x,解决方案可能是这样的:

<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 Hub页面上查找s2i图像可用的标签:https://hub.docker.com/r/fabric8/s2i-java/tags

对我来说,上面的这个解决方案没有帮助,但感谢!我发现我必须在我的个人资料定义中声明图像。我正在像这样运行我的openshift构建:mvn clean fabric8:deploy -P openshift对我帮助很大的是将其添加到配置文件:

<properties>
<fabric8.generator.fromMode>docker</fabric8.generator.fromMode>
<fabric8.generator.from>fabric8/s2i-java:3.0-java11</fabric8.generator.from>
</properties>

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

<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>

相关内容

  • 没有找到相关文章

最新更新