C.4. 安装 OpenShift Maven 插件

此插件位于 Maven central 存储库下,并可连接到预集成阶段,如下所示。默认情况下,Maven 只搜索 org.apache.maven.plugins 和 org.codehaus.mojo 软件包中的插件。要解析 JKube 插件目标的供应商,请编辑 ~/.m2/settings.xml 文件并添加 org.eclipse.jkube 命名空间,以便 <pluginGroups> 配置。

流程

  • 要将 OpenShift Maven 插件连接到 pre-integration 阶段,请将以下内容添加到 ~/.m2/settings.xml 文件中:
<settings>
      ...

      <pluginGroups>
        <pluginGroup>org.jboss.redhat-fuse</pluginGroup>
      </pluginGroups>

      ...
</settings>

<plugin>
  <groupId>org.jboss.redhat-fuse</groupId>
  <artifactId>openshift-maven-plugin</artifactId>
  <version>${fuse.version}</version>

  <configuration>
     ....
     <images>
        <!-- A single's image configuration -->
        <image>
          ...
          <build>
           ....
          </build>
        </image>
        ....
     </images>
  </configuration>

  <!-- Connect oc:resource, oc:build and oc:helm to lifecycle phases -->
  <executions>
    <execution>
       <id>jkube</id>
       <goals>
         <goal>resource</goal>
         <goal>build</goal>
         <goal>helm</goal>
       </goals>
    </execution>
  </executions>
</plugin>