0

私は戦争と瓶の間の耳とコミュニケーションを作成するのは初めてです...

私は完全に独立した機能を持つ2つの戦争をしていました。ここで、2つのアプリケーションが同じ機能で動作する必要があるEarを作成する必要があります。これは、jarで囲まれています。ただし、両方のPom.xmlにjarを含めるのではなく、そのjarを使用する必要があります。 3つは片耳の下にあります。これは可能ですか?私は2つの独立した戦争でEarをテストしましたが、上記を達成する方法はうまく機能していますが、これは得られません。
Jboss7.1.1でMavenを使用しています。JAR / WAR / EARのMessageHandlerhttps:
//stackoverflow.com/questions/1796255/tell-me-a-clear-differnece-between-ear-war-and-jar などのリンクを確認しましたが、上記についてはわかりませんでした。問題。

4

2 に答える 2

0
Hi got the solution >> here it is.. this is a pom.xml of ear project


<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>
  <groupId>Test</groupId>
  <artifactId>Test</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>ear</packaging> 

<dependencies>
    <!--Dependency for jar-->
    <dependency>
        <groupId>com.jar</groupId>
        <artifactId>com.jar</artifactId>
        <version>1.0</version>
        <type>war</type>
    </dependency>
    <!--Dependency for war1-->
    <dependency>
        <groupId>com.war2</groupId>
        <artifactId>com.war2</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <type>war</type>
    </dependency>       
    <!--Dependency for war2-->  
    <dependency>
        <groupId>com.war1</groupId>
        <artifactId>com.war1</artifactId>
        <version>0.0.1-SNAPSHOT</version>
        <type>war</type>
    </dependency>
</dependencies>

<build>
    <finalName>Project</finalName>
    <plugins>
        <plugin>
            <artifactId>maven-ear-plugin</artifactId>
            <version>2.8</version>
            <configuration>
                <finalName>MyEarFile</finalName>
                <version>5</version>
                <modules>
                    <!--Webmodule for war1-->
                    <webModule>
                        <groupId>com.war1</groupId>
                        <artifactId>com.war1</artifactId>
                        <uri>war1.war</uri>
                        <bundleFileName>war1.war</bundleFileName>
                    </webModule>

                    <!--Webmodule for war2-->
                    <webModule>
                        <groupId>com.war2</groupId>
                        <artifactId>com.war2</artifactId>
                        <uri>war2.war</uri>
                        <bundleFileName>war2.war</bundleFileName>
                    </webModule>
                </modules>
            </configuration>
        </plugin>
    </plugins>
  </build>
</project>




Note:: groupId and artifactId metioned here must match with groupId and artifactId mentioned in the project's pom.xml.
Also dependency of jar must be present in this i.e. ear's pom.xml and not in both app's pom.xml.
At time of maven install it automatically refers to jar's contents..
于 2013-02-16T13:07:47.033 に答える
0

複数の戦争と瓶を耳に入れることができ、それらは同じクラスローダーを共有することができます。これは、すべてのクラスがすべてのjar/warからアクセスできることを意味します。つまり、すべてのクラス/リソースがサブパッケージなしで1つのアーカイブにあるかのようです。

これが「戦争と壺の間のコミュニケーション」の意味だと思います。

編集:耳を構築するためのpom.xmlの例については、MavenでEARを作成するを確認してください。この例では、1つのjarと1つの戦争がありますが、任意の数の戦争/jarを持つことができます。

于 2013-02-16T11:01:23.317 に答える