On 4 Dec 2005, at 17:20, Brian E. Fox wrote:
http://maven.apache.org/guides/introduction/introduction-to-dependency-m
echanism.html
Of course, but …
Dependency scope is used to limit the transitivity of a depedency, and
also to affect the classpath used for various build tasks.
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.
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?
* 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?
* 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.
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?
Next, what is the <optional /> tag in a dependency declaration about?
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?
________________________________<x-tad-smaller>Met vriendelijke groeten,
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/
Jan Dockx
</x-tad-smaller><x-tad-smaller>
PeopleWare NV - Head Office</x-tad-smaller><x-tad-smaller>
Cdt.Weynsstraat 85
B-2660 Hoboken
Tel: +32 3 448.33.38
Fax: +32 3 448.32.66 </x-tad-smaller><x-tad-bigger>
</x-tad-bigger><x-tad-smaller>
PeopleWare NV - Branch Office Geel</x-tad-smaller><x-tad-smaller>
Kleinhoefstraat 5
B-2440 Geel
Tel: +32 14 57.00.90
Fax: +32 14 58.13.25</x-tad-smaller><x-tad-bigger>
</x-tad-bigger><x-tad-smaller>
http://www.peopleware.be/
</x-tad-smaller><x-tad-smaller>http://www.mobileware.be/</x-tad-smaller>
smime.p7s
Description: S/MIME cryptographic signature