【问题标题】:Howto use Maven Cargo Plugin to deploy a Web Application Bundle (WAB, OSGI + JavaEE) into Glassfish 3.x如何使用 Maven Cargo 插件将 Web 应用程序包(WAB、OSGI + JavaEE)部署到 Glassfish 3.x
【发布时间】:2013-04-15 13:39:57
【问题描述】:

我正在尝试使用 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>

但出现以下错误:

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

部署为“web”组件类型有效,但我无法使用 OSGI 捆绑包...

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

【问题讨论】:

    标签: maven glassfish osgi cargo wab


    【解决方案1】:

    尝试使用版本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

    【讨论】:

      【解决方案2】:

      诀窍是:

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

      【讨论】:

        【解决方案3】:

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

        asadmin deploy --type=osgi foo.war

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

        萨胡

        【讨论】:

        • 你是对的,但问题是如何传递这个参数!通过对货源的分析,我发现,当模块的打包类型为“bundle”时,类型设置为“osgi”,而在混合应用程序中,打包类型为“war”。
        猜你喜欢
        • 2014-12-23
        • 2016-09-29
        • 1970-01-01
        • 1970-01-01
        • 2011-01-17
        • 2012-03-15
        • 1970-01-01
        相关资源
        最近更新 更多