In Apache JAMES we have a multimodule project depending on javamail.

We want to easily switch from sun's javamail to geronimo javamail and back for testing purposes.

What is the maven best practice for this?

I don't want to go through all of our modules dependencies and alter their declaration and at the same time I don't want my parent pom (in the multimodule root) to include a dependency on that as not all of the modules should require javamail.

I currently added

<properties>
<javax.mail.groupId>org.apache.geronimo.javamail</javax.mail.groupId>
<javax.mail.artifactId>geronimo-javamail_1.4_mail</javax.mail.artifactId>
<javax.activation.groupId>org.apache.geronimo.specs</javax.activation.groupId>
<javax.activation.artifactId>geronimo-activation_1.1_spec</javax.activation.artifactId>
<!--
<javax.activation.groupId>javax.activation</javax.activation.groupId>
<javax.activation.artifactId>activation</javax.activation.artifactId>
<javax.mail.groupId>javax.mail</javax.mail.groupId>
<javax.mail.artifactId>mail</javax.mail.artifactId>
-->
</properties>

to my main pom and then used similar snippets in child poms:

<dependency>
  <groupId>${javax.mail.groupId}</groupId>
  <artifactId>${javax.mail.artifactId}</artifactId>
</dependency>


Is this the best way?

I would have preferred a way in dependencyManagement to declare that a given artifact already provides/substitute another artifactId/groupId because I will not be able to always tune childs this way and also I have to manually exclude sun's javamail dependency from any other dependency I have otherwise I end up with both implementations included in the classpath.

Stefano

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

Reply via email to