Seam 框架、maven-ear-plugin 和 Jboss 为 5.1.0

发布于 2024-09-27 19:28:14 字数 4375 浏览 4 评论 0原文

有人可以给我提供一个 pom.xml 的工作示例,用于在 jboss 5.1.0 上构建和部署 Ear 存档。
在我的应用程序中,我有两个模块 - web(.war 存档)和 java(.jar)。我正在尝试使用以下 pom.xml 完成上述任务

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
    <artifactId>tp</artifactId>
    <groupId>com.domain.project</groupId>
    <version>0.1</version>
</parent>
<groupId>com.domain.project</groupId>
<artifactId>build</artifactId>
<version>0.1</version>
<packaging>ear</packaging>
<name>project</name>

<repositories>
    ...
</repositories>

<build>

    <finalName>project</finalName>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jboss-maven-plugin</artifactId>
            <version>1.4.1</version>
            <configuration>
                <jbossHome>/opt/jboss-5.1.0.GA</jbossHome>
                <hostName>localhost</hostName>
                <serverName>default</serverName>
                <port>8080</port>
                <fileNames>
                    <fileName>${basedir}/target/${build.finalName}.ear</fileName>
                </fileNames>
            </configuration>
        </plugin>

        <plugin>
            <artifactId>maven-ear-plugin</artifactId>
            <version>2.4.2</version>
            <configuration>
                <generateApplicationXml>true</generateApplicationXml>
                <jboss>
                    <modules>
                        <webModule>web.war</webModule>
                        <ejbModule>core.jar</ejbModule>
                    </modules>
                    <version>5</version>
                    <loader-repository>com.domain.project:loader=project</loader-repository>
                </jboss>
                <modules>
                    <webModule>
                        <groupId>com.domain.project</groupId>
                        <artifactId>web</artifactId>
                        <bundleDir>/</bundleDir>
                    </webModule>
                    <javaModule>
                        <groupId>com.domain.project</groupId>
                        <artifactId>core</artifactId>
                        <bundleFileName>core.jar</bundleFileName>
                    </javaModule>

                </modules>
            </configuration>
        </plugin>

    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>com.domain.project</groupId>
        <artifactId>core</artifactId>
        <version>0.1</version>
    </dependency>
    <dependency>
        <groupId>com.domain.project</groupId>
        <artifactId>web</artifactId>
        <version>0.1</version>
        <type>war</type>
    </dependency>
    <dependency>
        <groupId>org.jboss.el</groupId>
        <artifactId>jboss-el</artifactId>
        <version>1.0_02.CR4</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>org.jboss.seam</groupId>
        <artifactId>jboss-seam</artifactId>
        <version>2.2.0.GA</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>org.jbpm</groupId>
        <artifactId>jbpm-jpdl</artifactId>
        <version>3.2.2</version>
        <type>jar</type>
    </dependency>
</dependencies>

但是我遇到以下异常
org.jboss.deployers.spi.DeploymentException:无法处理元数据

似乎 application.xml 或 jboss-app.xml 生成得不好......任何帮助将不胜感激。

Can someone provide me a working example of pom.xml which is used to build and deploy ear archive on jboss 5.1.0.
In my application I have two modules - web (.war archive) and java (.jar). I'm trying to accoplish the above task using the following pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
    <artifactId>tp</artifactId>
    <groupId>com.domain.project</groupId>
    <version>0.1</version>
</parent>
<groupId>com.domain.project</groupId>
<artifactId>build</artifactId>
<version>0.1</version>
<packaging>ear</packaging>
<name>project</name>

<repositories>
    ...
</repositories>

<build>

    <finalName>project</finalName>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jboss-maven-plugin</artifactId>
            <version>1.4.1</version>
            <configuration>
                <jbossHome>/opt/jboss-5.1.0.GA</jbossHome>
                <hostName>localhost</hostName>
                <serverName>default</serverName>
                <port>8080</port>
                <fileNames>
                    <fileName>${basedir}/target/${build.finalName}.ear</fileName>
                </fileNames>
            </configuration>
        </plugin>

        <plugin>
            <artifactId>maven-ear-plugin</artifactId>
            <version>2.4.2</version>
            <configuration>
                <generateApplicationXml>true</generateApplicationXml>
                <jboss>
                    <modules>
                        <webModule>web.war</webModule>
                        <ejbModule>core.jar</ejbModule>
                    </modules>
                    <version>5</version>
                    <loader-repository>com.domain.project:loader=project</loader-repository>
                </jboss>
                <modules>
                    <webModule>
                        <groupId>com.domain.project</groupId>
                        <artifactId>web</artifactId>
                        <bundleDir>/</bundleDir>
                    </webModule>
                    <javaModule>
                        <groupId>com.domain.project</groupId>
                        <artifactId>core</artifactId>
                        <bundleFileName>core.jar</bundleFileName>
                    </javaModule>

                </modules>
            </configuration>
        </plugin>

    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>com.domain.project</groupId>
        <artifactId>core</artifactId>
        <version>0.1</version>
    </dependency>
    <dependency>
        <groupId>com.domain.project</groupId>
        <artifactId>web</artifactId>
        <version>0.1</version>
        <type>war</type>
    </dependency>
    <dependency>
        <groupId>org.jboss.el</groupId>
        <artifactId>jboss-el</artifactId>
        <version>1.0_02.CR4</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>org.jboss.seam</groupId>
        <artifactId>jboss-seam</artifactId>
        <version>2.2.0.GA</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>org.jbpm</groupId>
        <artifactId>jbpm-jpdl</artifactId>
        <version>3.2.2</version>
        <type>jar</type>
    </dependency>
</dependencies>

However I'm getting the following exception
org.jboss.deployers.spi.DeploymentException: Cannot process metadata

Seems that application.xml or jboss-app.xml aren't generated well... Any help will be appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

深白境迁sunset 2024-10-04 19:28:14

重现您的项目结构和问题似乎很难(或者至少很耗时)。因此,我的建议是使用 10 秒内开始使用 JBoss Seam 和 Maven! 创建示例应用程序(具有按预期工作的构建)并模仿配置

要引导项目,请运行以下命令:

$ mvn archetype:generate \
        -DarchetypeGroupId=de.akquinet.jbosscc \
        -DarchetypeArtifactId=jbosscc-seam-archetype \
        -DarchetypeVersion=1.2 \
        -DarchetypeCatalog=http://seam-archetype.sourceforge.net/jbosscc-seam-archetype/1.2/archetype-catalog.xml 
...
Define value for property 'groupId': : com.domain.project
Define value for property 'artifactId': : seam-demo
Define value for property 'version':  1.0-SNAPSHOT: : 
Define value for property 'package':  com.domain.project: : 
Define value for property 'seamVersion': : 2.2.0.GA
Confirm properties configuration:
groupId: com.domain.project
artifactId: seam-demo
version: 1.0-SNAPSHOT
package: com.domain.project
seamVersion: 2.2.0.GA
 Y: : 
...
[INFO] BUILD SUCCESS
...

cd 进入 seam-demo 目录,运行 mvn install 以及两个 应用程序.xmljboss-app.xml将在ear模块中生成。

然后,使用您提供的jboss-maven-plugin配置将ear硬部署到为我工作的启动JBoss。

It seems hard (or at least time consuming) to reproduce your project structure and problem. For this reason, my suggestion would be to use the archetype announced in Getting started with JBoss Seam and Maven in 10 seconds! to create a sample application (with a build that is working as expected) and to mimic the configuration.

To bootstrap the project, run the following command:

$ mvn archetype:generate \
        -DarchetypeGroupId=de.akquinet.jbosscc \
        -DarchetypeArtifactId=jbosscc-seam-archetype \
        -DarchetypeVersion=1.2 \
        -DarchetypeCatalog=http://seam-archetype.sourceforge.net/jbosscc-seam-archetype/1.2/archetype-catalog.xml 
...
Define value for property 'groupId': : com.domain.project
Define value for property 'artifactId': : seam-demo
Define value for property 'version':  1.0-SNAPSHOT: : 
Define value for property 'package':  com.domain.project: : 
Define value for property 'seamVersion': : 2.2.0.GA
Confirm properties configuration:
groupId: com.domain.project
artifactId: seam-demo
version: 1.0-SNAPSHOT
package: com.domain.project
seamVersion: 2.2.0.GA
 Y: : 
...
[INFO] BUILD SUCCESS
...

And cd into the seam-demo directory, run mvn install and both the application.xml and the the jboss-app.xml will be generated in the ear module.

Then, using the jboss-maven-plugin configuration you provided to hard-deploy the ear to a started JBoss worked for me.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文