You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Sean Schofield <se...@gmail.com> on 2006/01/02 16:46:36 UTC

[m2] Dependency scope options

I'm having trouble determining the scope choices for a dependency
entry.  Right now I have something like:

    <dependency>
    	<groupId>commons-codec</groupId>
			<artifactId>commons-codec</artifactId>
			<version>1.3</version>
      <scope>compile</scope>
    </dependency>

    <dependency>
    	<groupId>commons-codec</groupId>
			<artifactId>commons-codec</artifactId>
			<version>1.3</version>
      <scope>test</scope>
    </dependency>

I'd like to combine this dependency into one entry in my POM.  Is ther
a value that covers *both* compile and test?

TIA,

Sean

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


Re: [m2] Dependency scope options

Posted by Sean Schofield <se...@gmail.com>.
John,

Thanks for the link.  That is what I was looking for.  I don't know
why I couldn't find it on my own but I was having trouble ;-)

Sean

On 1/2/06, John Fallows <jo...@gmail.com> wrote:
> Sean,
>
> On 1/2/06, Sean Schofield <se...@gmail.com> wrote:
> >
> > I'm having trouble determining the scope choices for a dependency
> > entry.  Right now I have something like:
> >
> >     <dependency>
> >         <groupId>commons-codec</groupId>
> >                         <artifactId>commons-codec</artifactId>
> >                         <version>1.3</version>
> >       <scope>compile</scope>
> >     </dependency>
> >
> >     <dependency>
> >         <groupId>commons-codec</groupId>
> >                         <artifactId>commons-codec</artifactId>
> >                         <version>1.3</version>
> >       <scope>test</scope>
> >     </dependency>
> >
> > I'd like to combine this dependency into one entry in my POM.  Is ther
> > a value that covers *both* compile and test?
> >
>
> Here's the definition of the scopes from the Maven documentation at
> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
>
> There are 5 scopes available:
>
>    - *compile* - this is the default scope, used if none is specified.
>    Compile dependencies are available in all classpaths.
>    - *provided* - this is much like compile, but indicates you expect the
>    JDK or a container to provide it. It is only available on the compilation
>    classpath, and is not transitive.
>    - *runtime* - this scope indicates that the dependency is not required
>    for compilation, but is for execution. It is in the runtime and test
>    classpaths, but not the compile classpath.
>    - *test* - this scope indicates that the dependency is not required
>    for normal use of the application, and is only available for the test
>    compilation and execution phases.
>    - *system* - this scope is similar to provided except that you have to
>    provide the JAR which contains it explicitly. The artifact is always
>    available and is not looked up in a repository.
>
> There should be no need to explicitly specify <scope>compile</scope>, as
> that is the default, and covers all classpaths, including test scope.
>
> Kind Regards,
> John Fallows.
>
> --
> Author Pro JSF and Ajax: Building Rich Internet Components
> http://www.apress.com/book/bookDisplay.html?bID=10044
>
>

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


Re: [m2] Dependency scope options

Posted by John Fallows <jo...@gmail.com>.
Sean,

On 1/2/06, Sean Schofield <se...@gmail.com> wrote:
>
> I'm having trouble determining the scope choices for a dependency
> entry.  Right now I have something like:
>
>     <dependency>
>         <groupId>commons-codec</groupId>
>                         <artifactId>commons-codec</artifactId>
>                         <version>1.3</version>
>       <scope>compile</scope>
>     </dependency>
>
>     <dependency>
>         <groupId>commons-codec</groupId>
>                         <artifactId>commons-codec</artifactId>
>                         <version>1.3</version>
>       <scope>test</scope>
>     </dependency>
>
> I'd like to combine this dependency into one entry in my POM.  Is ther
> a value that covers *both* compile and test?
>

Here's the definition of the scopes from the Maven documentation at
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

There are 5 scopes available:

   - *compile* - this is the default scope, used if none is specified.
   Compile dependencies are available in all classpaths.
   - *provided* - this is much like compile, but indicates you expect the
   JDK or a container to provide it. It is only available on the compilation
   classpath, and is not transitive.
   - *runtime* - this scope indicates that the dependency is not required
   for compilation, but is for execution. It is in the runtime and test
   classpaths, but not the compile classpath.
   - *test* - this scope indicates that the dependency is not required
   for normal use of the application, and is only available for the test
   compilation and execution phases.
   - *system* - this scope is similar to provided except that you have to
   provide the JAR which contains it explicitly. The artifact is always
   available and is not looked up in a repository.

There should be no need to explicitly specify <scope>compile</scope>, as
that is the default, and covers all classpaths, including test scope.

Kind Regards,
John Fallows.

--
Author Pro JSF and Ajax: Building Rich Internet Components
http://www.apress.com/book/bookDisplay.html?bID=10044