This is an interesting situation. The classes that use Jackson are all 
considered optional in Log4j, so having optional set to true is indeed what is 
desired. However, we require those dependencies to compile and to run the unit 
tests.  With scope set to test I would expect that the non-test classes that 
need them would fail to compile.  So it sounds like we have to make sure all 
transitive dependencies needed for testing are also specified with optional set 
to true?

Ralph


> On Jul 6, 2016, at 12:18 PM, Stuart McCulloch <mccu...@gmail.com> wrote:
> 
> BTW, https://issues.apache.org/jira/browse/MNG-5227 was about making the 
> optional flag of a dependency manageable.
> 
> Previously any optional flags in dependencyManagement sections were ignored, 
> and it looks like the Log4j build relies on that historical behaviour. For 
> example the jackson dependencies are all currently marked as optional in the 
> top-level dependencyManagement. With previous versions of Maven these managed 
> flags were simply ignored and had no effect on the build. With the 
> 644ac9c40ad41bf61e3b099918af33b8eb950621 maven build these optional flags 
> were now being managed across any jackson dependencies in all sub-projects. 
> Since jackson-module-jaxb-annotations was not declared as a direct dependency 
> in log4j-core, but was only a transitive dependency of 
> jackson-dataformat-xml, this ended up being marked as ‘optional’ and removed 
> from the test-classpath.
> 
> Removing the ‘optional’ flags from the dependencyManagement section in the 
> top-level pom.xml cleans up the build and should work with both old and 
> future versions of Maven.  
> 
> On Wednesday, 6 July 2016 at 19:45, Stuart McCulloch wrote:
> 
>> That looks like the build (644ac9c40ad41bf61e3b099918af33b8eb950621) before 
>> MNG-5227 and other breaking changes were rolled back
>> 
>> I just tried with a maven distribution built from latest master 
>> (227085283b6379038ec16f4cf9ad2e8869cef694) and the Log4J build is passing  
>> 
>> On Wednesday, 6 July 2016 at 19:24, Gary Gregory wrote:
>> 
>>> A while back, a post made available a 3.4.0 SNAPSHOT build for testing. So
>>> I'm using it here and there.
>>> 
>>> To replicate the 3.4.0-S failure (works fine on 3.3.9):
>>> 
>>> Download
>>> https://repository.apache.org/content/repositories/orgapachelogging-1020/org/apache/logging/log4j/log4j-distribution/2.6.2/log4j-distribution-2.6.2-src.zip
>>> 
>>> (this link will be gone in a couple of days)
>>> 
>>> Or checkout the tag with "git clone
>>> https://git-wip-us.apache.org/repos/asf/logging-log4j2.git"; and then "git
>>> checkout tags/log4j-2.6.2-rc1”
>>> 
>>> Using the src distro with 'mvn clean package' (Maven 3.4.0-SNAPSHOT), I am
>>> getting:
>>> 
>>> Failed tests:
>>> XmlCompactFileAppenderTest.testFlushAtEndOfBatch:66 line1 incorrect:
>>> [<?xml version="1.0" encoding="UTF-8"?><Events xmlns="
>>> http://logging.apache.org/log4j/2.0/events";></Events>], does not contain:
>>> [<Event ]
>>> XmlCompleteFileAppenderTest.testChildElementsAreCorrectlyIndented:139
>>> line3 incorrect: [</Events>], must have two-space indentation
>>> XmlCompleteFileAppenderTest.testFlushAtEndOfBatch:74 line3
>>> XmlFileAppenderTest.testFlushAtEndOfBatch:64 line1
>>> Tests in error:
>>> MarkerMixInXmlTest>MarkerMixInTest.setUp:45 ╗ NoClassDefFound
>>> com/fasterxml/ja...
>>> MarkerMixInXmlTest>MarkerMixInTest.setUp:45 ╗ NoClassDefFound
>>> com/fasterxml/ja...
>>> MarkerMixInXmlTest>MarkerMixInTest.setUp:45 ╗ NoClassDefFound
>>> com/fasterxml/ja...
>>> ThrowableProxyTest.testIoContainerAsXml:95->testIoContainer:78 ╗
>>> NoClassDefFound
>>> StackTraceElementMixInTest.testLog4jXmlObjectMapper:58->roundtrip:51 ╗
>>> NoClassDefFound
>>> XmlLayoutTest.testLayout:214 ╗ NoClassDefFound
>>> com/fasterxml/jackson/module/ja...
>>> XmlLayoutTest.testLayoutLoggerName:262 ╗ NoClassDefFound
>>> com/fasterxml/jackson...
>>> XmlLayoutTest.testLocationOffCompactOffMdcOff:268->testAllFeatures:122 ╗
>>> NoClassDefFound
>>> XmlLayoutTest.testLocationOnCompactOnMdcOn:273->testAllFeatures:122 ╗
>>> NoClassDefFound
>>> org.apache.logging.log4j.core.net.server.SslXmlSocketServerTest.org.apache.logging.log4j.core.net.server.SslXmlSocketServerTest
>>> Run 1: SslXmlSocketServerTest.setupClass:64 ╗ NoClassDefFound
>>> com/fasterxml/jackson/m...
>>> Run 2: SslXmlSocketServerTest.tearDownClass:71 NullPointer
>>> 
>>> org.apache.logging.log4j.core.net.server.TcpXmlSocketServerTest.org.apache.logging.log4j.core.net.server.TcpXmlSocketServerTest
>>> Run 1: TcpXmlSocketServerTest.setupClass:38 ╗ NoClassDefFound
>>> com/fasterxml/jackson/m...
>>> Run 2: TcpXmlSocketServerTest.tearDownClass:45 NullPointer
>>> 
>>> org.apache.logging.log4j.core.net.server.UdpXmlSocketServerTest.org.apache.logging.log4j.core.net.server.UdpXmlSocketServerTest
>>> Run 1: UdpXmlSocketServerTest.setupClass:38 ╗ NoClassDefFound
>>> com/fasterxml/jackson/m...
>>> Run 2: UdpXmlSocketServerTest.tearDownClass:44 NullPointer
>>> 
>>> Everything works fine with Maven 3.3.9.
>>> 
>>> Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5;
>>> 2015-11-10T08:41:47-08:00)
>>> Maven home: E:\Java\apache-maven-3.3.9
>>> Java version: 1.8.0_91, vendor: Oracle Corporation
>>> Java home: C:\Program Files\Java\jdk1.8.0_91\jre
>>> Default locale: en_US, platform encoding: Cp1252
>>> OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
>>> 
>>> Apache Maven 3.4.0-SNAPSHOT (644ac9c40ad41bf61e3b099918af33b8eb950621;
>>> 2016-06-11T12:17:57-07:00)
>>> Maven home: E:\Java\apache-maven-3.4.0-SNAPSHOT\bin\..
>>> Java version: 1.8.0_91, vendor: Oracle Corporation
>>> Java home: C:\Program Files\Java\jdk1.8.0_91\jre
>>> Default locale: en_US, platform encoding: Cp1252
>>> OS name: "Windows 7", version: "6.1", arch: "amd64", family: "Windows"
>>> 
>>> Thank you
>>> Gary (Apache Logging PMC)
>>> 
>>> --  
>>> E-Mail: garydgreg...@gmail.com (mailto:garydgreg...@gmail.com) | 
>>> ggreg...@apache.org (mailto:ggreg...@apache.org)
>>> Java Persistence with Hibernate, Second Edition
>>> <http://www.manning.com/bauer3/>
>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>> Spring Batch in Action <http://www.manning.com/templier/>
>>> Blog: http://garygregory.wordpress.com
>>> Home: http://garygregory.com/
>>> Tweet! http://twitter.com/GaryGregory
>>> 
>>> 
>>> 
>> 
>> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to