Uploaded image for project: 'Drools'
  1. Drools
  2. DROOLS-357

Multiple static initialization makes debugging Maven issues impossible

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Done
    • Major
    • 6.0.1.Final
    • 6.0.0.Final
    • None

    Description

      When running kie-ci tests against productized binaries, most of the tests in that module fail with this particular exception (or similar):

      java.lang.NoClassDefFoundError: Could not initialize class org.kie.scanner.MavenRepository
      at org.kie.scanner.KieModuleMavenTest.testKieModulePojoDependencies(KieModuleMavenTest.java:119)

      Turns out, this exception is (through multiple levels of static initialization) actually caused here:
      https://github.com/droolsjbpm/drools/blob/master/kie-ci/src/main/java/org/kie/scanner/embedder/MavenProjectLoader.java#L10

      Maven resolution fails, because it cannot find some dependencies in the project being loaded. As a result, the class is never initialized, fast forward two other classes, and you get the above exception. I kindly ask that this behavior be changed in such a way that the original exception bubbles up through the stack - otherwise, the user has no chance to figure out what's going on.

      The issue is a bit tricky to reproduce, as it's directly related to artifacts not being resolvable - but it should, if my understanding of the error is correct, be enough to have a parser error in the POM that's being loaded.

      Attachments

        Activity

          People

            mfusco@redhat.com Mario Fusco
            lpetrovi@redhat.com Lukáš Petrovický (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: