svn commit: r476429 - /jakarta/commons/proper/logging/trunk/pom.xml

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r476429 - /jakarta/commons/proper/logging/trunk/pom.xml

Simon Kitching
Author: skitching
Date: Fri Nov 17 19:41:32 2006
New Revision: 476429

URL: http://svn.apache.org/viewvc?view=rev&rev=476429
Log:
Add comments about unusual dependency-handling approach.

Modified:
    jakarta/commons/proper/logging/trunk/pom.xml

Modified: jakarta/commons/proper/logging/trunk/pom.xml
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/logging/trunk/pom.xml?view=diff&rev=476429&r1=476428&r2=476429
==============================================================================
--- jakarta/commons/proper/logging/trunk/pom.xml (original)
+++ jakarta/commons/proper/logging/trunk/pom.xml Fri Nov 17 19:41:32 2006
@@ -310,10 +310,27 @@
     </plugins>
   </build>
   
+  <!--
+    - Special dependency handling follows. What we really want for JCL is to declare
+    - dependencies that are required when compiling but optional at runtime.
+    - Unfortunately Maven2 doesn't support this directly; if we use normal dependency
+    - declarations then *users* of JCL will get all the supported logging libs
+    - pulled into their project by default, but if we declare them optional then
+    - when JCL is *compiled* we get none of them in the classpath.
+    - A workaround is used here where two profiles are declared; one is active only
+    - when compiling and has "normal" dependencies while the other is active when
+    - other apps declare a dependency on this pom and as "optional" dependencies.
+    -->
   <profiles>
     <profile>
       <id>build</id>
       <activation>
+        <!--
+          - If this file is present in the current directory, then assume that
+          - someone has checked out the JCL source code and is building it. In
+          - this case declare "normal" dependencies so the logging adapters
+          - can be compiled.
+          -->
         <file>
           <exists>commons-logging-README.txt</exists>
         </file>
@@ -352,6 +369,13 @@
     <profile>
       <id>use</id>
       <activation>
+        <!--
+          - If this file is not in the current directory, then assume that
+          - this pom is being processed because it is referenced as a
+          - dependency of some other project. In this case, don't pull in
+          - any particular logging library; the using project needs to declare
+          - a dependency on whatever lib they really want present.
+          -->
         <file>
           <missing>commons-logging-README.txt</missing>
         </file>



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r476429 - /jakarta/commons/proper/logging/trunk/pom.xml

Wendy Smoak
On 11/17/06, [hidden email] <[hidden email]> wrote:
> Author: skitching
> Date: Fri Nov 17 19:41:32 2006
> New Revision: 476429
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=476429
> Log:
> Add comments about unusual dependency-handling approach.
...
>     if we declare them optional then
> +    - when JCL is *compiled* we get none of them in the classpath.

Are you saying that if you mark the dependencies optional, you get
compilation errors?  That doesn't sound right.

If you mark it optional, it will be excluded from transitive
dependency resolution when a project depends on commons-logging.  But
it should be on the compile-time classpath.

--
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r476429 - /jakarta/commons/proper/logging/trunk/pom.xml

Simon Kitching
On Fri, 2006-11-17 at 20:53 -0700, Wendy Smoak wrote:

> On 11/17/06, [hidden email] <[hidden email]> wrote:
> > Author: skitching
> > Date: Fri Nov 17 19:41:32 2006
> > New Revision: 476429
> >
> > URL: http://svn.apache.org/viewvc?view=rev&rev=476429
> > Log:
> > Add comments about unusual dependency-handling approach.
> ...
> >     if we declare them optional then
> > +    - when JCL is *compiled* we get none of them in the classpath.
>
> Are you saying that if you mark the dependencies optional, you get
> compilation errors?  That doesn't sound right.

Well, that's exactly what happens.

[INFO] Compilation failure

/home/simon/apache/commons-svn/proper/logging/trunk/src/java/org/apache/commons/logging/impl/Log4JLogger.java:[23,24] package org.apache.log4j does not exist

etc

>
> If you mark it optional, it will be excluded from transitive
> dependency resolution when a project depends on commons-logging.  But
> it should be on the compile-time classpath.
>

That's what I'd like to see happen, but it doesn't appear to (using
maven 2.0.4 on Linux).

Regards,

Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r476429 - /jakarta/commons/proper/logging/trunk/pom.xml

Wendy Smoak
On 11/17/06, Simon Kitching <[hidden email]> wrote:

> > Are you saying that if you mark the dependencies optional, you get
> > compilation errors?  That doesn't sound right.
>
> Well, that's exactly what happens.

Found it.  Optional is not a scope, it's a separate element.

Instead of <scope>optional</scope>, use <optional>true</optional>.

--
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

[logging] Re: svn commit: r476429 - /jakarta/commons/proper/logging/trunk/pom.xml

Simon Kitching
On Fri, 2006-11-17 at 21:19 -0700, Wendy Smoak wrote:

> On 11/17/06, Simon Kitching <[hidden email]> wrote:
>
> > > Are you saying that if you mark the dependencies optional, you get
> > > compilation errors?  That doesn't sound right.
> >
> > Well, that's exactly what happens.
>
> Found it.  Optional is not a scope, it's a separate element.
>
> Instead of <scope>optional</scope>, use <optional>true</optional>.
>

Thank you Wendy! That makes a whole lot more sense.

It would be really nice if Maven would report an error if the scope
value is invalid rather than silently ignoring the dependency completely
(as 2.0.4 evidently does). I'll try to check with mvn trunk and request
an enhancement if this behaviour is still the same (unless someone has
the latest maven trunk checked out and can check more easily?).

Regards,

Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [logging] Re: svn commit: r476429 - /jakarta/commons/proper/logging/trunk/pom.xml

Wendy Smoak
On 11/18/06, Simon Kitching <[hidden email]> wrote:

> It would be really nice if Maven would report an error if the scope
> value is invalid rather than silently ignoring the dependency completely
> (as 2.0.4 evidently does). I'll try to check with mvn trunk and request
> an enhancement if this behaviour is still the same (unless someone has
> the latest maven trunk checked out and can check more easily?).

Neither the Maven 2.0.5 nor 2.1 snapshot complains about an invalid
scope, I just get the same compilation failure.  I'll go see if
there's an issue open already.

--
Wendy

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]