You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Stefano Bagnara <ap...@bago.org> on 2008/08/20 12:24:55 UTC

javax.mail:mail vs org.apache.geronimo.javamail:geronimo-javamail_1.4_mail

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: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: javax.mail:mail vs org.apache.geronimo.javamail:geronimo-javamail_1.4_mail

Posted by Jörg Schaible <jo...@gmx.de>.
Hi Stefano,

Stefano Bagnara wrote:

> 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?

We use always the Sun version, but declare it (already in an inherited
depMgmnt section) as provided (as it is in an JEE env or newer JDKs). Then
you can easily write an IT using the Geronimo version.

- Jörg


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: javax.mail:mail vs org.apache.geronimo.javamail:geronimo-javamail_1.4_mail

Posted by Carlos Sanchez <ca...@carlossanchez.eu>.
there' s no solution yet for this problem, yours is probably the easiest option
see http://jira.codehaus.org/browse/MNG-2316

On Wed, Aug 20, 2008 at 12:24 PM, Stefano Bagnara <ap...@bago.org> wrote:
> 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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: javax.mail:mail vs org.apache.geronimo.javamail:geronimo-javamail_1.4_mail

Posted by Daniel Kulp <dk...@apache.org>.
What you came up with is about the only option that really works right now.   
You could add a "sunmail" profile that changes those properties so you can 
run:
mvn install
for geronimo, and:
mvn install -Psunmail
for Sun mail.  That would at least avoid having to edit the pom each time.

Dan



On Wednesday 20 August 2008 6:24:55 am Stefano Bagnara wrote:
> 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.group
>Id>
> <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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org



-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org