On Thu, Oct 16, 2008 at 4:46 AM, Matt Raible <[EMAIL PROTECTED]> wrote:
>
> On Wed, Oct 15, 2008 at 8:44 PM, Alexander Coles <[EMAIL PROTECTED]>
> wrote:
>
> >> You should be able to modify the dependencies in pom.xml (or exclude
> them
> >> if they're from another dependency) and set them to
> >> <optional>true</optional> so they're not included in the WAR.
> >>
> >> Matt
> >
> >
> > Thanks, Matt. I tried adding the optional element to the javax.mail
> > dependency in my core/pom.xml.
> >
> > <dependency>
> > <groupId>javax.mail</groupId>
> > <artifactId>mail</artifactId>
> > <version>${javamail.version}</version>
> > <optional>true</optional>
> > </dependency>
> >
> > This didn't seem to fix it, though. However, what did do the trick was to
> > add an exclusion in the reference to the parent POM in web/pom.xml (as I
> > stated before, I've run appfuse:full-source).
> >
> > <dependency>
> > <groupId>${pom.parent.groupId}</groupId>
> > <artifactId>${pom.parent.artifactId}-core</artifactId>
> > <version>${pom.parent.version}</version>
> > <exclusions>
> > <exclusion>
> > <artifactId>mail</artifactId>
> > <groupId>javax.mail</groupId>
> > </exclusion>
> > </exclusions>
> > </dependency>
> >
> > For right now, it works. But, I am not sure 100% why the <optional>
> element
> > isn't working -- perhaps I am not understanding the documentation at
> >
> http://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.htmlcorrectly?
>
>
Optional might not be working because another dependency is pulling
>
the JAR in. You can run "mvn dependency:tree" to see a dependency
>
graph.
>
> Matt
Thanks. That helped me understand the issue. As you rightfully stated, it
was another dependency causing the issue: in this case, its XFIre, which
brings in the mail.jar dependency.
Without the exclusion, this is the dependency tree for the web/ module.
[INFO] | +- org.codehaus.xfire:xfire-java5:jar:1.2.6:compile
[INFO] | | +- org.codehaus.xfire:xfire-aegis:jar:1.2.6:compile
[INFO] | | | \- net.java.dev.stax-utils:stax-utils:jar:20040917:compile
[INFO] | | +- org.codehaus.xfire:xfire-annotations:jar:1.2.6:compile
[INFO] | | +- xfire:xfire-jsr181-api:jar:1.0-M1:compile
[INFO] | | \- org.codehaus.xfire:xfire-core:jar:1.2.6:compile
[INFO] | | +- javax.activation:activation:jar:1.1:compile
[INFO] | | +- javax.mail:mail:jar:1.4:compile
[INFO] | | +- wsdl4j:wsdl4j:jar:1.6.1:compile
[INFO] | | +- stax:stax-api:jar:1.0.1:compile
[INFO] | | +- org.codehaus.woodstox:wstx-asl:jar:3.2.0:compile
[INFO] | | \- commons-httpclient:commons-httpclient:jar:3.0:compile
Therefore an <exclusion> was needed, in addition to making javax.mail
optional in core/pom.xml.
Alex