2009/3/19 sebb <[email protected]> > On 19/03/2009, Stephen Connolly <[email protected]> wrote: > > 2009/3/19 sebb <[email protected]> > > > > > On 19/03/2009, Stephen Connolly <[email protected]> > wrote: > > > > 2009/3/19 sebb <[email protected]> > > > > > > > > > > > > > Can I get back to my original question, which is: > > > > > > > > > > How does one express a dependency on a jar which is only needed > at > > > > > compile time, such that the dependency is not propagated? > > > > > > > > > > > > > > > > > scope provided will do what you need afaik > > > > > > > > > > Yes, but then AFAIK the user has to download and install the jar > > > separately, which is a pain. > > > > > > > > > Nope.... > > I think you meant "Yep..." as you seem to be agreeing with me. >
I meant Nope... as I was disagreeing with you > > > provided just says that somebody will provide it for you and that maven > does > > not need to worry about it. > > > provided says that the final deployment location of the jar will have whatever classes are needed at runtime to fullfil this jar's requirements. The classes in the jar with provided scope should be on maven's compile and test classpaths for this module... this jar is not needed for any transitive dependencies. > > Yes, I know. > > Maven maybe does not have to worry about it, but the user does, which > is what I want to avoid. > IF you are certain that annotations with runtime retention do not break classloading, then you are fine. Use scope "provided" problem solved. > > AIUI "provided" is mainly intended for jars that are not available via > the repository, e.g. they may be commercial jars that have to be paid > for separately. > Nope, provided is for artifacts that are either provided in another form by the container in which the jar will run, or are not actually needed. (Note: <optional>true</optional> should have the same effect but I have never quite got that to work the way it should) -Stephen
