You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Paul Spencer <pa...@apache.org> on 2007/05/11 14:49:21 UTC

How to include Optional dependencies?

How can I include a dependency's optional dependency without
adding the optional dependency to the pom?

As an example, shale-test has an optional dependency on commons-digester.  Since
my application does not use commons-digester, I do not have it defined as
a dependency in the pom.  When the test that used shale-test failed I had to
determine the failure was due to a missing dependency that was defined in shale-test's
pom. Thus the following questions.

1) Is their a way I can include all of a dependencies optional dependencies
    without knowing what they are?

           <dependency>
             <groupId>org.apache.shale</groupId>
             <artifactId>shale-test</artifactId>
             <version>1.1.0-SNAPSHOT</version>
             <scope>test</scope>
             <includeOptionalDependencies all="true"/>  <!-- Just a guess to illustrate the intent -->
           <dependency>


2) Is their a way I can include selected optional dependencies for a dependency?

           <dependency>
             <groupId>org.apache.shale</groupId>
             <artifactId>shale-test</artifactId>
             <version>1.1.0-SNAPSHOT</version>
             <scope>test</scope>
             <includeOptionalDependencies>  <!-- Just a guess to illustrate the intent -->
               <dependency>
                 <groupId>commons-digester</groupId>
                 <artifactId>commons-digester</artifactId>
               </dependency>
             </includeOptionalDependencies>
           <dependency>

3) Can optional dependencies be grouped to allow for the inclusion of a
    named group of optional dependencies, thus freeing the user from
    having to know and maintain a list of optional dependencies to
    include?

           <dependency>
             <groupId>org.apache.shale</groupId>
             <artifactId>shale-test</artifactId>
             <version>1.1.0-SNAPSHOT</version>
             <scope>test</scope>
             <includeOptionalDependencies group="FunctionalGroup1"/>  <!-- Just a guess to illustrate the intent -->
           <dependency>


Paul Spencer

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


Re: How to include Optional dependencies?

Posted by Wayne Fay <wa...@gmail.com>.
Currently, the answer to all of your questions is "no".

However it seems like you have some not unreasonable ideas here, so it
might be worth filing a JIRA Enhancement request so something along
these lines could be included in M2.1.x if the Maven team decided to
implement them.

Wayne

On 5/11/07, Paul Spencer <pa...@apache.org> wrote:
> How can I include a dependency's optional dependency without
> adding the optional dependency to the pom?
>
> As an example, shale-test has an optional dependency on commons-digester.
> Since
> my application does not use commons-digester, I do not have it defined as
> a dependency in the pom.  When the test that used shale-test failed I had to
> determine the failure was due to a missing dependency that was defined in
> shale-test's
> pom. Thus the following questions.
>
> 1) Is their a way I can include all of a dependencies optional dependencies
>     without knowing what they are?
>
>            <dependency>
>              <groupId>org.apache.shale</groupId>
>              <artifactId>shale-test</artifactId>
>              <version>1.1.0-SNAPSHOT</version>
>              <scope>test</scope>
>              <includeOptionalDependencies all="true"/>  <!-- Just a guess to
> illustrate the intent -->
>            <dependency>
>
>
> 2) Is their a way I can include selected optional dependencies for a
> dependency?
>
>            <dependency>
>              <groupId>org.apache.shale</groupId>
>              <artifactId>shale-test</artifactId>
>              <version>1.1.0-SNAPSHOT</version>
>              <scope>test</scope>
>              <includeOptionalDependencies>  <!-- Just a guess to illustrate
> the intent -->
>                <dependency>
>                  <groupId>commons-digester</groupId>
>                  <artifactId>commons-digester</artifactId>
>                </dependency>
>              </includeOptionalDependencies>
>            <dependency>
>
> 3) Can optional dependencies be grouped to allow for the inclusion of a
>     named group of optional dependencies, thus freeing the user from
>     having to know and maintain a list of optional dependencies to
>     include?
>
>            <dependency>
>              <groupId>org.apache.shale</groupId>
>              <artifactId>shale-test</artifactId>
>              <version>1.1.0-SNAPSHOT</version>
>              <scope>test</scope>
>              <includeOptionalDependencies group="FunctionalGroup1"/>  <!--
> Just a guess to illustrate the intent -->
>            <dependency>
>
>
> Paul Spencer
>
> ---------------------------------------------------------------------
> 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