You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Yoav Shapira <yo...@apache.org> on 2007/01/23 21:15:37 UTC

Commons-logging 1.1 POM: why isn't servlet-api scope=provided ?

Hola,
I think that the commons-logging Maven POM
(http://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk/pom.xml
in SVN) should specify scope="provided" for its Servlet API
dependency.  That helps users by not including the Servlet API in
packaged artifacts, such as WARs, that use commons-logging.

Is there a reason why the default scope ("compile") is used instead?
The provided scope, as described at
http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html,
is designed exactly for this use case.

BTW, I noticed the new optional=true parameter that's in the POM on
SVN trunk (see above URL), but not yet in the Maven repositories
(ftp://ibiblio.org/pub/packages/maven2/commons-logging/commons-logging/1.1/commons-logging-1.1.pom).
 That's a good step, but it's not sufficient for this case and does
not provide the same functionality as add scope="provided."

Thanks,

Yoav

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Commons-logging 1.1 POM: why isn't servlet-api scope=provided ?

Posted by Dennis Lundberg <de...@apache.org>.
Yoav Shapira wrote:
> Hola,
> I think that the commons-logging Maven POM
> (http://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk/pom.xml 
> 
> in SVN) should specify scope="provided" for its Servlet API
> dependency.  That helps users by not including the Servlet API in
> packaged artifacts, such as WARs, that use commons-logging.
> 
> Is there a reason why the default scope ("compile") is used instead?

I don't think so.

> The provided scope, as described at
> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html, 
> 
> is designed exactly for this use case.
> 
> BTW, I noticed the new optional=true parameter that's in the POM on
> SVN trunk (see above URL), but not yet in the Maven repositories
> (ftp://ibiblio.org/pub/packages/maven2/commons-logging/commons-logging/1.1/commons-logging-1.1.pom). 
> 
> That's a good step, but it's not sufficient for this case and does
> not provide the same functionality as add scope="provided."
> 
> Thanks,
> 
> Yoav

I'll play around with different scopes and see what I can come up with, 
but my initial feeling is that your suggestion is correct.

-- 
Dennis Lundberg

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Commons-logging 1.1 POM: why isn't servlet-api scope=provided ?

Posted by Yoav Shapira <yo...@apache.org>.
Hola,

On 1/23/07, Craig McClanahan <cr...@apache.org> wrote:
> That's a good step, but it's not sufficient for this case and does
> > not provide the same functionality as add scope="provided."
>
>
> Why?  The part of C-L that depends on the servlet API is indeed optional,

That's my bad wording.  Declaring the dependency as optional would
actually be sufficient for my use-case.  However, as the Maven doc
notes (http://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html),
optional dependencies are a stop-gap measure.  I think the
scope="provided" is a bit cleaner and has clearer semantics to users.

Either way, it looks like this is being addressed or will be shortly:
thanks for the quick responses.  Now I just have to wait for the next
JCL release ;)  Actually, if it's as simple as just packaging and
updating the web site, I guess I could do it myself.

Yoav

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Commons-logging 1.1 POM: why isn't servlet-api scope=provided ?

Posted by Wendy Smoak <ws...@gmail.com>.
On 1/24/07, Simon Kitching <sk...@apache.org> wrote:

> Well, actually, the dependency on servlet-api should probably be marked
> both optional *and* provided, in that it is not needed in order to use
> many JCL features, but if you do want to use the JCL "cleanup on webapp
> unload" then the supporting jar is expected to be provided by the
> surrounding environment. However as it's not possible to use both,
> optional seems to more correctly describe the usage to me.

It should be possible to use both.  Optional is not a scope, it's a
separate element.  What happens with:

   <dependency>
      ...
      <scope>provided</scope>
      <optional>true</optional>
   </dependency>
?

-- 
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Commons-logging 1.1 POM: why isn't servlet-api scope=provided ?

Posted by Simon Kitching <sk...@apache.org>.
On Tue, 2007-01-23 at 16:54 -0500, Yoav Shapira wrote:
> Hola,
> 
> On 1/23/07, Craig McClanahan <cr...@apache.org> wrote:
> > That's a good step, but it's not sufficient for this case and does
> > > not provide the same functionality as add scope="provided."
> >
> >
> > Why?  The part of C-L that depends on the servlet API is indeed optional,
> 
> That's my bad wording.  Declaring the dependency as optional would
> actually be sufficient for my use-case.  However, as the Maven doc
> notes (http://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html),
> optional dependencies are a stop-gap measure.  I think the
> scope="provided" is a bit cleaner and has clearer semantics to users.

I would agree with Craig's assessment of this - optional seems the
correct scope to me.

Well, actually, the dependency on servlet-api should probably be marked
both optional *and* provided, in that it is not needed in order to use
many JCL features, but if you do want to use the JCL "cleanup on webapp
unload" then the supporting jar is expected to be provided by the
surrounding environment. However as it's not possible to use both,
optional seems to more correctly describe the usage to me.

The linked page describes optional dependencies as a "stop-gap" compared
to splitting the project into submodules, not compared to using
"provided" scope. However splitting the servlet-related functionality of
JCL into a separate module/jar would just be silly - it's only one
class, and JCL is full of other optional dependencies anyway.

> 
> Either way, it looks like this is being addressed or will be shortly:
> thanks for the quick responses.  Now I just have to wait for the next
> JCL release ;)  Actually, if it's as simple as just packaging and
> updating the web site, I guess I could do it myself.

The only outstanding issue I know of is deciding how to do the actual
release build, because we want to support java 1.2, but JCL also
contains java.util.logging stuff that only builds with java1.4. In the
past, spearate compilers have been used to build various bits then the
results stitched together. I would prefer to build the lot with java 1.6
using -target 1.2 and then run the unit tests against this jar using
java1.2 to verify the results are usable but (a) need to figure out how
to do that, and (b) need to get agreement that it is an acceptable
approach.

Cheers,

Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Re: Commons-logging 1.1 POM: why isn't servlet-api scope=provided ?

Posted by Craig McClanahan <cr...@apache.org>.
On 1/23/07, Yoav Shapira <yo...@apache.org> wrote:
>
> Hola,
> I think that the commons-logging Maven POM
> (
> http://svn.apache.org/repos/asf/jakarta/commons/proper/logging/trunk/pom.xml
> in SVN) should specify scope="provided" for its Servlet API
> dependency.  That helps users by not including the Servlet API in
> packaged artifacts, such as WARs, that use commons-logging.
>
> Is there a reason why the default scope ("compile") is used instead?
> The provided scope, as described at
>
> http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
> ,
> is designed exactly for this use case.


It was an oversight.

BTW, I noticed the new optional=true parameter that's in the POM on
> SVN trunk (see above URL), but not yet in the Maven repositories
> (
> ftp://ibiblio.org/pub/packages/maven2/commons-logging/commons-logging/1.1/commons-logging-1.1.pom
> ).


Yep ... basically we're waiting for someone to have the energy to manage a
1.1.1 release ... as far as I know there are no other outstanding issues
(there was a question of whether the trunk code works in applets, but AFAIK
the answer was yes).

That's a good step, but it's not sufficient for this case and does
> not provide the same functionality as add scope="provided."


Why?  The part of C-L that depends on the servlet API is indeed optional,
and we don't want to trigger transitive dependencies on, say, a rich client
app that was using C-L and would not normally have a servlet API jar lying
around.  My understanding of "provided" is that this would still make the
servlet API be required, but not "included" with
commons-logging-xxx.jar(which does not really mean anything in a
project that produces a JAR
instead of a WAR).

Thanks,
>
> Yoav


Craig


---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>