2

我正在尝试使用 Maven Cargo 插件来部署一组 OSGI 包和一个混合应用程序 .war(带有使用 OSGI 的 Restservice 的 Web 应用程序),也称为 Web 应用程序包(或 WAB)(例如,参见https://glassfish. java.net/public/GF-OSGi-Features.pdf)。

将 OSGI 包部署到 Glassfish 3.1.x 中工作正常,但我还没有找到部署 Web 应用程序包的方法。

它的包装是“战争”,但我必须将它部署为 OSGI 包。那么我怎么能告诉这个 Cargo 插件呢?

我尝试使用的 Maven 配置:

  <plugin>
    <groupId>org.codehaus.cargo</groupId>
    <artifactId>cargo-maven2-plugin</artifactId>
    <version>1.4.0</version>
    <configuration>
      <wait>false</wait>

      <container>
        <containerId>glassfish3x</containerId>
        <home>${glassfish.home}</home>
        <type>installed</type>
      </container>
      <configuration>
        <type>existing</type>
        <home>${glassfish.home}</home>
        <properties>
          <cargo.hostname>localhost</cargo.hostname>
          <cargo.rmi.port>4848</cargo.rmi.port>
          <cargo.domain.name>${glassfish.domain}</cargo.domain.name>
        </properties>
      </configuration>
      <deployables>
        <deployable>
          <groupId>com.acme.rest</groupId>
          <artifactId>rest-api</artifactId>
          <type>bundle</type>
        </deployable>
      </deployables>
    </configuration>
  </plugin>

但出现以下错误:

[错误] 无法在项目 rest-api 上执行目标 org.codehaus.cargo:cargo-maven2-plugin:1.4.0:redeploy (default-cli):工件 [com.acme.rest:rest-api:bundle] 是不是项目的依赖项。-> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: 未能执行目标 org.codehaus.cargo:cargo-maven2-plugin:1.4.0:redeploy (default-cli) on project rest-api: Artifact [ com.acme.rest:rest-api:bundle] 不是项目的依赖项。

部署为组件类型“web”有效,但是我不能使用 OSGI 包......

有人有部署 Web 应用程序包和 OSGI 包的经验吗?

4

3 回答 3

1

我不知道 cargo 插件,但要使用 asadmin 客户端部署 wab,必须通过 --type=osgi 选项,如下所示:

asadmin deploy --type=osgi foo.war

所以,看看你是否可以配置 cargo 插件来传递这个选项。

萨虎

于 2013-04-23T16:00:42.573 回答
0

诀窍是:

<deployable>
  <groupId>com.acme.rest</groupId>
  <artifactId>rest-api</artifactId>
  <type>war</type>
  <implementation>org.codehaus.cargo.container.deployable.Bundle</implementation>
</deployable>

您仍然有一个 WAR 工件,但 Bundle 会欺骗 Cargo 将其部署为 OSGi。

于 2013-07-14T00:35:38.353 回答
0

尝试使用1.4.7添加了对发送asadmin参数的支持的版本以及@Sahoo 提到的参数。

<cargo.glassfish.deploy.arg.1>--type=osgi foo.war</cargo.glassfish.deploy.arg.1>

允许为 glassfish 部署传递额外参数 https://jira.codehaus.org/browse/CARGO-1245

于 2014-02-21T03:00:57.430 回答