Paul Smith wrote:
Could some explain the difference between the dependency scope
"provided" versus "optional" if there actually is any..
We have converted log4j over to Maven recently and accidently forgot to
mark a few dependencies with flags indicating that, while needing for
compile time, should not necessarily be enforced on the end user.
I refer people to this issue:
https://issues.apache.org/bugzilla/show_bug.cgi?id=43304
I originally used 'optional' because I saw this being used in the
ActiveMQ project, but now I can't find any real definitive reference to
what that means.
Taken from the POM reference at
http://maven.apache.org/ref/current/maven-model/maven.html#class_dependency
optional means:
"Indicates the dependency is optional for use of this library. While the
version of the dependency will be taken into account for dependency
calculation if the library is used elsewhere, it will not be passed on
transitively."
I've read:
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
and that makes no mention of the 'optional' scope type. Is it a legacy
marker?
It's not a scope, but a separate option on a dependency. So you can have
something like this:
<scope>compile</scope>
<optional>true</optional>
That means that the dependency is needed to compile the project, but it
is optional for the end user. Depending on which parts of your projects
code he/she uses. An example of this would be javax.mail that is needed
by the SMPTAppender. If a user decides that they will never use the
SMTPAppender then they do not need to include javax-mail - it is optional.
If someone could provide advice here I would appreciate it.
Which of your dependencies do you need help with? I did the POM for
Commons Logging 1.1.1, so I have a pretty good idea of what's needed.
I'd love to see a working POM for log4j, see my patches to the issue
mentioned above.
cheers,
Paul
--
Dennis Lundberg
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]