You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Zarick Lau <za...@gmail.com> on 2007/08/12 12:53:15 UTC

'true' not inherited from parent POM

Dear users and developers,

While I'm tidy up an multi-module project, I found strange an issue:

In the parent pom, I have an artifact defined with 'optional=true'
within the dependencyManagement:
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.thoughtworks.xstream</groupId>
        <artifactId>xstream</artifactId>
        <version>${xstream-version}</version>
        <optional>true</optional>
      </dependency>
    </dependencies>
  </dependencyManagement>

In a child module (module-a), I declare the dependency as follow
  <dependencies>
    <dependency>
      <groupId>com.thoughtworks.xstream</groupId>
      <artifactId>xstream</artifactId>
    </dependency>
  </dependencies>

If I run mvn help:effective-pom under the child module (module-a),
it shows me that, the dependency is NOT optional (optional tag is absence)

In another child module which depends on child module-a to build an ear,
it also pull the xstream package, just like the dependency is not optional.

Does 'optional' attribute supposed to be inherited by parent POM?

Thanks!

Best regards,
Zarick Lau

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


Re: 'true' not inherited from parent POM

Posted by Zarick Lau <za...@gmail.com>.
On 8/13/07, Wayne Fay <wa...@gmail.com> wrote:
> As far as I'm concerned, optional doesn't make any sense in
> <dependencyManagement>. So I think what you're seeing is the correct
> behavior.

Does it mean that, depMgmt is only concerned about 'version' resolve?
As I can use 'scope' also in depMgmt, that's inspire me to try to use
'optional'.

By the way, I fine with either case, because optional dep is only minor case.

Also, if optional is not supposed to be put under depMgmt, should it be removed
from the POM reference doc and the XSD also (I have check out those
doc initially,
as optional is listed as valid child element under depMgt/deps/dep.)

Ref: http://maven.apache.org/ref/current/maven-model/maven.html

Anyway, thanks very much for your clarification!

Best regards,
Zarick

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


Re: 'true' not inherited from parent POM

Posted by Wayne Fay <wa...@gmail.com>.
As far as I'm concerned, optional doesn't make any sense in
<dependencyManagement>. So I think what you're seeing is the correct
behavior.

If you want an element to be optional, you need to declare it as such
in the child poms where you declare the dependency (minus version,
which is inherited from the parent depMgmt).

Wayne

On 8/12/07, Zarick Lau <za...@gmail.com> wrote:
> Dear users and developers,
>
> While I'm tidy up an multi-module project, I found strange an issue:
>
> In the parent pom, I have an artifact defined with 'optional=true'
> within the dependencyManagement:
>  <dependencyManagement>
>    <dependencies>
>      <dependency>
>        <groupId>com.thoughtworks.xstream</groupId>
>        <artifactId>xstream</artifactId>
>        <version>${xstream-version}</version>
>        <optional>true</optional>
>      </dependency>
>    </dependencies>
>  </dependencyManagement>
>
> In a child module (module-a), I declare the dependency as follow
>  <dependencies>
>    <dependency>
>      <groupId>com.thoughtworks.xstream</groupId>
>      <artifactId>xstream</artifactId>
>    </dependency>
>  </dependencies>
>
> If I run mvn help:effective-pom under the child module (module-a),
> it shows me that, the dependency is NOT optional (optional tag is absence)
>
> In another child module which depends on child module-a to build an ear,
> it also pull the xstream package, just like the dependency is not optional.
>
> Does 'optional' attribute supposed to be inherited by parent POM?
>
> Thanks!
>
> Best regards,
> Zarick Lau
>
> ---------------------------------------------------------------------
> 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