Can't you do it like this:

project
|--pom.xml
|
`--parent
|  |--pom.xml
|
`--rar
|  |--pom.xml
|
`--ear
|  |--pom.xml

parent/pom.xml:
---------------------------------------
<project>
<modelVersion>4.0.0</modelVersion>
        
<groupId>test</groupId>
<artifactId>test-parent</artifactId>
<version>1.0-SNAPSHOT</version>
        
<packaging>pom</packaging>

<name>Parent</name>
        
<dependencyManagement>
  <dependencies>
    <dependency>
      <groupId>axis</groupId>
      <artifactId>axis</artifactId>
      <version>1.1</version>
    </dependency>
  </dependencies>
</dependencyManagement>

</project>
---------------------------------------

ear/pom.xml:
---------------------------------------
<project>

  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>test</groupId>
    <artifactId>test-parent</artifactId>
    <version>1.0-SNAPSHOT</version>
    <relativePath>../parent</relativePath>
  </parent>

  <groupId>de.foo</groupId>
  <artifactId>bar-ear</artifactId>
  <version>1.0</version>
  <name>Foo::Bar EAR</name>
  <packaging>ear</packaging>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-ear-plugin</artifactId>
        <configuration>
          <defaultJavaBundleDir>APP-INF/lib</defaultJavaBundleDir>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>de.foo</groupId>
      <artifactId>bar-connector</artifactId>
      <version>1.0</version>
      <type>rar</type>
    </dependency>
    <dependency>
      <groupId>axis</groupId>
      <artifactId>axis</artifactId>
    </dependency>
  </dependencies>
</project>
---------------------------------------

rar/pom.xml:
---------------------------------------
<project

  <modelVersion>4.0.0</modelVersion>
        
  <parent>
     <groupId>test</groupId>
    <artifactId>test-parent</artifactId>
    <version>1.0-SNAPSHOT</version>
    <relativePath>../parent</relativePath>
  </parent>

  <groupId>de.foo</groupId>
  <artifactId>bar-connector</artifactId>
  <version>1.0</version>

  <name>Foo::Bar Rar</name>
  <packaging>rar</packaging>

  <build>
  </build>
  <dependencies>
    <dependency>
      <groupId>axis</groupId>
      <artifactId>axis</artifactId>
      <scope>provided</scope>
    </dependency>
  </dependencies>
</project>
---------------------------------------

Of course you don't need a distinct parent and aggregation pom (project/pom.xml). You can just merge the two and use the project level pom as the parent.

BTW, you don't need to specify this:

<modules>
  <rarModule>
    <groupId>test</groupId>
    <artifactId>test-ejb</artifactId>
  </rarModule>
</modules>

This section is used only if you need to configure the way the module is handled by the plugin like specifying the bundleFileName.

-Tim

Carsten Karkola schrieb:
No, I need the jar in the ear, my example - just to make clear what I try to describe :-):

$>mkdir -p rar/src/main/rar/META-INF
$>touch rar/src/main/rar/META-INF/ra.xml
$>touch rar/pom.xml
$>mkdir -p ear
$>touch ear/pom.xml

ear/pom.xml:
<?xml version="1.0" encoding="iso-8859-1"?>
<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/maven-v4_0_0.xsd";>

  <modelVersion>4.0.0</modelVersion>
  <groupId>de.foo</groupId>
  <artifactId>bar-ear</artifactId>
  <version>1.0</version>
  <name>Foo::Bar EAR</name>
  <packaging>ear</packaging>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-ear-plugin</artifactId>
        <configuration>
          <defaultJavaBundleDir>APP-INF/lib</defaultJavaBundleDir>
          <modules>
            <rarModule>
              <groupId>de.foo</groupId>
              <artifactId>bar-connector</artifactId>
            </rarModule>
          </modules>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
      <groupId>de.foo</groupId>
      <artifactId>bar-connector</artifactId>
      <version>1.0</version>
      <type>rar</type>
    </dependency>
  </dependencies>
</project>

rar/pom.xml:
<?xml version="1.0" encoding="iso-8859-1"?>
<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/maven-v4_0_0.xsd";>

  <modelVersion>4.0.0</modelVersion>
  <groupId>de.foo</groupId>
  <artifactId>bar-connector</artifactId>
  <version>1.0</version>
  <name>Foo::Bar Rar</name>
  <packaging>rar</packaging>
  <build>
  </build>
  <dependencies>
    <dependency>
      <groupId>axis</groupId>
      <artifactId>axis</artifactId>
      <version>1.1</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>
</project>

At least the build:
$>cd rar
$>mvn clean install
$>cd ../ear
$>mvn package

The problem:
If I have <scope>provided</scope>, axis is missing in the rar and in the ear.
If I remove this line, Im ending up with axis in APP-INF/lib and inside the rar.

How can I avoid this; I'd like to exclude the axis.jar only from the rar not from the ear, background: I have a lot of rars with some more dependencies, that are shared in all the rars, I'd like to deploy these dependencies only once in APP-INF/lib not in every rar and in APP-INF/lib.

regards, carsten


On 30 May 2006 at 18:19, Roland Asmann wrote:

Set the scope to provided ONLY on the rar-projects, NOT on the EAR.



On Tuesday 30 May 2006 18:02, Carsten Karkola wrote:
If I use "provided" the dependencies will never be included, my problem is
1. projects:
  rar1: dependency to my-jar
  rar2: dependency to my-jar
  ejb1: dependency to my-jar
  ear: dependency to rar1, rar2
2. inside the ear:
    ejb1.jar
    rar1.rar
    rar2.rar
    lib/my-jar.jar
3. This works fine for packaging=ejb - the my-jar.jar gets copied to the
lib dir during build of the ear. But the same jar gets also packaged in the
rar1 and in the rar2 archive. So I have it three times instead only having
the entries in MANFIFEST.MF/Class-Path and the jar only once in the lib
subdir.
The Manifest entries are not the problem, to get the jar not packaged in
the rars is my problem.

regards, carsten

On 30 May 2006 at 10:24, Wayne Fay wrote:
I can't tell if you're running M2 or M1...

But in M2, to exclude a dependency from being included in a package,
we use the <scope>provided</scope> tag to override the default
"compile" scope. Provided tells the packager that this
dependency/artifact/library will be provided by the app server etc,
and so it does not need to be included in the archive/package.

Wayne

On 5/30/06, Carsten Karkola <[EMAIL PROTECTED]> wrote:
Hallo,

I have some subprojects with <packaging>rar</packaging> specified.
There are some dependencies specified, that need to be included in the
ear. I'd like to include these dependencies (like axis) only once in
the ear and not in every rar archive.
This way works fine with ejb archives. But with rar archives I get
these depend jars always included in the rar itself.
<includeJar>false</includeJar> doesn't help.

regards, carsten


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to