0

I have created a simple CXF & Spring web service and successfully build a war file using maven. Now I need to package this web service to an EAR file and deploy it on a remote weblogic server.

I have tried searching the web regarding how to using maven to build an EAR file for the CXF & Spring web service but not much information.

Does anyone have done this before and able to share how can I go about doing this?

Thanks!

4

1 回答 1

0

maven-ear-plugin 文档涵盖了很多内容。WebLogic 的特定部分是决定将使用哪种生产重新部署策略。如果计划使用“生产重新部署”,则需要在 ear manifest 中添加一个附加条目,以便 WebLogic 具有应用程序的版本信息(更多文档)。这是一个示例部分 POM。

<groupId>com.company.maven.sample</groupId>
<artifactId>myEarSimple</artifactId>
<version>${my.ear.version}</version>
<packaging>ear</packaging>

<build>
    <finalName>myAppEar</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-ear-plugin</artifactId>
            <version>2.8</version>
            <configuration>
                <version>5</version>  <!-- Java EE version used by the app -->
                <displayName>${project.artifactId}</displayName>
                <applicationName>${project.artifactId}</applicationName>
                <fileNameMapping>no-version</fileNameMapping>

                <archive>
                    <manifestEntries>
                        <!-- Must have this if you intend to use production redeployment, use whatever value you like as long as it conforms to WebLogic's version criteria specified in documentation provided -->
                        <Weblogic-Application-Version>${project.version}</Weblogic-Application-Version>
                    </manifestEntries>
                </archive>
                <modules>
                    <webModule>
                        <moduleId>myWebAppId</moduleId>
                        <groupId>com.company.maven.sample</groupId>
                        <artifactId>myWar</artifactId>
                        <contextRoot>myWarContextRoot</contextRoot>
                    </webModule>
                    <ejbModule>
                        <moduleId>myEjbId</moduleId>
                        <groupId>com.company.maven.sample</groupId>
                        <artifactId>myEjb</artifactId>
                    </ejbModule>
                    <!-- other modules here -->
                </modules>
            </configuration>
        </plugin>
    </plugins>
</build>

<dependencies>
    <!-- Here, you specify dependencies corresponding to the modules -->
    <dependency>
        <groupId>com.company.maven.sample</groupId>
        <artifactId>myWar</artifactId>
        <version>${the.war.version}</version>
        <type>war</type>
    </dependency>

    <dependency>
        <groupId>com.company.maven.sample</groupId>
        <artifactId>myEjb</artifactId>
        <version>${my.ejb.version}</version>
        <type>ejb</type>
    </dependency>
</dependencies>
于 2013-08-08T14:39:18.630 回答