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

时间:2010-10-17 15:45:55

标签: java-ee maven-2 jboss seam maven-ear-plugin

有人能为我提供一个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 ......我们将不胜感激。

1 个答案:

答案 0 :(得分:1)

重现项目结构和问题似乎很难(或者至少是耗时)。出于这个原因,我的建议是使用Getting started with JBoss Seam and Maven in 10 seconds!中宣布的原型创建一个示例应用程序(具有按预期工作的构建)并模仿配置

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

$ 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,并且将在ear模块中生成application.xmljboss-app.xml

然后,使用您提供的jboss-maven-plugin配置将耳朵硬件部署到已启动的JBoss上。