Maven 1.x Test Plugin
  1. Maven 1.x Test Plugin
  2. MPTEST-42

test fails when project depends on commons-logging-api

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      If a project has a dependency on commons-logging-api tests will fail because either maven, or the test plugin are already using a version of commons-logging-api.

      For example, project.xml contains:

      <dependency>
      <groupId>commons-logging</groupId>
      <artifactId>commons-logging-api</artifactId>
      <version>1.0.4</version>
      </dependency>

      Running 'maven test' produces the following in the test-reports output file:

      java.lang.ExceptionInInitializerError
      at JUnitTestCaseSubclass.testMethod(JUnitTestCaseSubclass.java:63)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at org.apache.commons.jelly.tags.ant.AntTag.doTag(AntTag.java:232)
      at org.apache.commons.jelly.impl.TagScript.run(TagScript.java:279)
      at org.apache.commons.jelly.impl.ScriptBlock.run(ScriptBlock.java:135)
      at org.apache.commons.jelly.TagSupport.invokeBody(TagSupport.java:233)
      ...
      Caused by: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of
      'org.apache.commons.logging.Log' visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log' visible, which is not allowed.) (Caused by org.apache.commons.logging.LogConfigurationException: org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version of 'org.apache.commons.logging.Log'
      visible, which is not allowed. (Caused by org.apache.commons.logging.LogConfigurationException: Invalid class loader hierarchy. You have more than one version
      of 'org.apache.commons.logging.Log' visible, which is not allowed.))
      at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:543)
      at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
      at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
      at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
      ...

      This call to LogFactory.getLog(...) occurs within the code under test.

      In order to get around this, the project must be compiled with the dependency in the project.xml file. Then 'maven test' must be run with the dependency commented out.

      A property within the dependency to ignore the dependency during test would be helpful. Otherwise, logic that detects the version conflict and excises the commons-logging-api.jar from the classpath during test, would be helpful.

        Activity

        Hide
        David Eric Pugh added a comment -

        Take a looksee at how junit dependency is used in the test.. You may want to see about submitting a patch that works similar for commons-logging...

        Show
        David Eric Pugh added a comment - Take a looksee at how junit dependency is used in the test.. You may want to see about submitting a patch that works similar for commons-logging...

          People

          • Assignee:
            Unassigned
            Reporter:
            Duffy Gillman
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: