mojohaus / license-maven-plugin

Maven plugin to download and collect license files from project dependencies.
https://www.mojohaus.org/license-maven-plugin/
GNU Lesser General Public License v3.0
107 stars 127 forks source link

Class not found on mvn license:aggregate-third-party-report #73

Closed Jessevanbekkum closed 7 years ago

Jessevanbekkum commented 7 years ago

When I try to run mvn license:aggregate-third-party-report I get a build failure, with the following error: Failed to execute goal org.codehaus.mojo:license-maven-plugin:1.12:aggregate-third-party-report (default-cli) on project ing-securities: Execution default-cli of goal org.codehaus.mojo:license-maven-plugin:1.12:aggregate-third-party-report failed: A required class was missing while executing org.codehaus.mojo:license-maven-plugin:1.12:aggregate-third-party-report: org/apache/maven/doxia/sink/render/RenderingContext

This is probably the same issue as https://github.com/mojohaus/license-maven-plugin/issues/69.

That issue was closed, but I think there still is something wrong here. I downloaded the doxia jars from maven central (http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.apache.maven.doxia%22%20AND%20a%3A%22doxia-core%22) and starting with version 1.5, the file org/apache/maven/doxia/sink/render/RenderingContext.class is not available anymore in the jar.

I was able to to get it working by adding this to my plugin definition:

          <dependencies>
            <dependency>
              <groupId>org.apache.maven.doxia</groupId>
              <artifactId>doxia-core</artifactId>
              <version>1.4</version>
            </dependency>
          </dependencies>

Here is a part of the stacktrace:

Error injecting: org.apache.maven.doxia.siterenderer.DefaultSiteRenderer
java.lang.ClassNotFoundException: org.apache.maven.doxia.sink.render.RenderingContext
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50) ~[plexus-classworlds-2.5.2.jar:na]
    at org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271) ~[plexus-classworlds-2.5.2.jar:na]
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247) ~[plexus-classworlds-2.5.2.jar:na]
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239) ~[plexus-classworlds-2.5.2.jar:na]
    ... 93 common frames omitted
Wrapped by: java.lang.NoClassDefFoundError: org/apache/maven/doxia/sink/render/RenderingContext
    at java.lang.Class.getDeclaredMethods0(Native Method) ~[na:1.8.0_101]
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) ~[na:1.8.0_101]
    at java.lang.Class.getDeclaredMethods(Class.java:1975) ~[na:1.8.0_101]
macGYves commented 7 years ago

This also happens when executing mvn license:third-party-report.

The workaround about adding doxia-core as plugin dependency worked for me, too.

bannmann commented 7 years ago

I have the same issue, and the workaround "fixes" the problem.

tchemit commented 7 years ago

Hi guys,

Which version of maven-site-plugin ae you using ?

dhalperi commented 7 years ago

Hi @tchemit I am getting this error with version 1.13:

➜  projects git:(maven-ify) ✗ mvn license:aggregate-third-party-report
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] Batfish
[INFO] batfish-common-protocol
[INFO] batfish
[INFO] batfish-client
[INFO] coordinator
[INFO] allinone
[INFO] question
[INFO] 
[INFO] ------------------------------------------------------------------------
[INFO] Building Batfish 0.29.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- license-maven-plugin:1.13:aggregate-third-party-report (default-cli) @ batfish-parent ---
[WARNING] Error injecting: org.apache.maven.doxia.siterenderer.DefaultSiteRenderer
java.lang.NoClassDefFoundError: org/apache/maven/doxia/sink/render/RenderingContext
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.getDeclaredMethods(Class.java:1975)
    at com.google.inject.spi.InjectionPoint.getInjectionPoints(InjectionPoint.java:688)
    at com.google.inject.spi.InjectionPoint.forInstanceMethodsAndFields(InjectionPoint.java:380)
    at com.google.inject.internal.ConstructorBindingImpl.getInternalDependencies(ConstructorBindingImpl.java:164)
macGYves commented 7 years ago

I'm on maven 3.3.9 and license-maven-plugin 1.12

jacobwil commented 6 years ago

For anyone just finding this now and running into a similar problem where org/apache/maven/doxia/siterenderer/RenderingContext is missing, I managed to get past that problem by making my <plugin> entry look like this:

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>license-maven-plugin</artifactId>
        <version>1.14</version>

        <dependencies>
          <dependency>
            <groupId>org.apache.maven.doxia</groupId>
            <artifactId>doxia-core</artifactId>
            <version>1.6</version>
          </dependency>
          <dependency>
            <groupId>org.apache.maven.doxia</groupId>
            <artifactId>doxia-site-renderer</artifactId>
            <version>1.6</version>
          </dependency>
        </dependencies>
      </plugin>
kajh commented 6 years ago

We get the folloing stacktrace after adding the license-maven-plugin as `

org.codehaus.mojo license-maven-plugin 1.16

` We use maven-site-plugin 3.7.1.

[WARNING] An issue has occurred with license-maven-plugin:1.16:third-party-report report, skipping LinkageError org/apache/maven/doxia/sink/SinkEventAttributeSet, please report an issue to Maven dev team. java.lang.NoClassDefFoundError: org/apache/maven/doxia/sink/SinkEventAttributeSet at org.codehaus.mojo.license.AbstractLicenseReportRenderer.sinkHeaderCellText(AbstractLicenseReportRenderer.java:176)

I added doxia-core and doxia-site-renderer as jacobwil described.

Any ideas? Thanks!

:)

ispringer commented 6 years ago

Why was this closed?

tchemit commented 6 years ago

A mistake I suppose :( I will have a look at it soon.--Enjoy and ShareTony Chemit

        On nov. 9 2018, at 9:00 pm, Ian Springer <notifications@github.com> wrote:

          Why was this closed?

—You are receiving this because you modified the open/close state.Reply to this email directly, view it on GitHub, or mute the thread.

vasiliy-bout commented 5 years ago

I've just tried to use the latest version 1.16, and the problem still persists. It was reported on version 1.12. Please, fix it. Can you just add this dependency into the plugin's pom.xml?

ptahchiev commented 5 years ago

They need to update the doxia-site-renderer from 1.4 to 1.8.1 - i don't know why they are not doing it.

digulla commented 5 years ago

With license-maven-plugin:1.16:aggregate-third-party-report, doxia 1.8 doesn't work for me. I had to use doxia 1.6 as in https://github.com/mojohaus/license-maven-plugin/issues/73#issuecomment-346130508

With doxia 1.8 and 1.8.1, org/apache/maven/doxia/sink/SinkEventAttributeSet is missing (probably was moved to a new package org.apache.maven.doxia.sink.impl in 1.8).

ppalaga commented 5 years ago

A pull request with an integration test is welcome.