"Nice. But can you give me an example of need and use? At first sight,
this goes for the entire java.* API. And if it is provided, why mention
it?" 
 
An example is the servlet.jar. You need it to compile, but don't want it
packaged in your war because the servlet container will "provide" it
automatically. The Java API isn't relevant because it's automatically
available to the compiler and at runtime. We're talking about other
dependancies here.
 

        * 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.
        


The runtime classpath? What is that? Is there a "run" goal? I understand
you need things that are required for execution are needed during test,
but than what is the difference with the test scope?
 
Things on the runtime scope are needed to run your artifact, but not to
compile it. 
 


        * 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.
        


This I understand.



        * 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.
        


Nice. But can you please give me an example, because I don't have the
faintest idea what you are talking about. 
Don't know either. Copied it from the url, but I haven't found a need
for it yet. 



        
        Each of the scopes affects transitive dependencies in different
ways, as
        is demonstrated in the table below. If a dependency is set to
the scope
        in the left column, dependencies with the scope across the top
row will
        result in a dependency in the main project with the scope listed
at the
        intersection. If no scope is listed, it means the dependency
will be
        omitted.
        


Ok. Scopes form an algebra, and the operation in this Caleigh table
looks a bit weird, but anyway. It is the sentence above that is a
liiiiiiiiittle complicated for me
"a dependency is set to the scope in the left column, dependencies with
the scope across the top row will resul ..." you lost me.

To clear this up, let's make some definitions:
The current project is the project whose POM we are editing.
The dependency is a project the user project directly depends on. This
dependency is labelled (2).
A user project is a project for which the current project is a direct
depency. This dependency is labelled (1). Consequentially, a user
project has an indirect depency on the dependency.

So:
user project <--(1)-- current project <--(2)--- dependency

Now, we are talking of the result of combining the scope of (1) with
(2), right? Now, in
<http://maven.apache.org/guides/introduction/introduction-to-dependency-
mechanism.html>, is 1 in the left column, and 2 in the top row, or is it
the other way around?  Yes, top. 



Next, what is the <optional /> tag in a dependency declaration about?
 It is supposed to mean that there may be a dependancy depending on how
it's used. Maybe a project has a need for struts or hibernate but not
all the time, perhaps depending on configuration. 


And finally, there is talk here and there about non-deterministic
version specifications (e.g., [1.0.0), or 1.0.0,2.0.0. Is this active in
maven 2.0? Is there any real documentation?
 It is active, it's documented somewhere but I don't remember where. You
are essentially specifying a range of allowable values. The way maven
picks the actual version when multiples are specified is a little
complicated. Search the archives cause I know it's been covered. 






        
        
        
        
        ________________________________
        
        From: ir. ing. Jan Dockx [mailto:[EMAIL PROTECTED] 
        Sent: Sunday, December 04, 2005 4:57 AM
        To: Maven Users List
        Subject: dependency scopes
        
        
        I *really* don't fully grasp dependency scopes. Could somebody
in the
        know please have a look at
        <http://docs.codehaus.org/display/MAVENUSER/Dependency+Scopes>
and
        correct some points?
        
        Or at least, give a 1-sentence use case (example) for each of
the
        scopes?
        
        Until now, I found the following scopes mentioned in docs:
        
        * compile
        * test
        * runtime
        * provided
        * system
        
        and the <optional /> tag
        
        
        Met vriendelijke groeten,
        
        Jan Dockx
        
        PeopleWare NV - Head Office
        Cdt.Weynsstraat 85 
        B-2660 Hoboken 
        Tel: +32 3 448.33.38 
        Fax: +32 3 448.32.66 
        
        PeopleWare NV - Branch Office Geel
        Kleinhoefstraat 5
        B-2440 Geel
        Tel: +32 14 57.00.90
        Fax: +32 14 58.13.25
        
        http://www.peopleware.be/
        http://www.mobileware.be/
        
        

Met vriendelijke groeten,

Jan Dockx

PeopleWare NV - Head Office
Cdt.Weynsstraat 85 
B-2660 Hoboken 
Tel: +32 3 448.33.38 
Fax: +32 3 448.32.66 

PeopleWare NV - Branch Office Geel
Kleinhoefstraat 5
B-2440 Geel
Tel: +32 14 57.00.90
Fax: +32 14 58.13.25

http://www.peopleware.be/
http://www.mobileware.be/

Reply via email to