mojohaus / jdepend-maven-plugin

JDepend Maven Plugin
https://www.mojohaus.org/jdepend-maven-plugin/
Apache License 2.0
5 stars 9 forks source link

LinkageError throws Warning and does not create a valid report #39

Open Bukama opened 4 weeks ago

Bukama commented 4 weeks ago

We updated the Maven-plugins (compile, jar, site, etc.) of one of our projects. This project is the only one that also uses the jdepend-maven-plugin (can't tell you why). The build then threw a warning and could not generate a proper JDepend report.

The project had the following dependency in the report section

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>jdepend-maven-plugin</artifactId>
        <version>2.0</version>
      </plugin> 

The warning is related to DOXIA so maybe to the site-plugin which is used in version 4.0.0-M14 (in which Doxia is updated for Maven 4 etc). Issues doesn't seem to pop with site-plugin 3.12.1

jepend

[INFO] <<< jdepend:2.0:generate (default-site) < compile @ XXX <<<
[INFO]
[INFO] 'compile' forked phase execution for jdepend-maven-plugin:generate report preparation done
[INFO] Detected 2 reports for jdepend-maven-plugin:2.0: generate-no-fork, generate
[INFO] Analysis cache created
[INFO] Fork Value is true
[INFO] Done SpotBugs Analysis....
[INFO] Skipping org.apache.maven.plugins:maven-surefire-report-plugin:3.2.5:failsafe-report-only report
[INFO] Skipping JaCoCo execution due to missing execution data file.
[INFO] Skipping org.jacoco:jacoco-maven-plugin:0.8.7:report-integration report
[INFO] Relativizing site links with respect to localized project URL: XXXX 
[INFO] Rendering content with org.apache.maven.skins:maven-fluido-skin:jar:2.0.0-M8 skin
[INFO] Skipped "Source Xref" report (maven-jxr-plugin:3.3.2:jxr-no-fork), file "xref/index.html" already exists.
[INFO] Skipped "Test Source Xref" report (maven-jxr-plugin:3.3.2:test-jxr-no-fork), file "xref-test/index.html" already exists.
[INFO] Skipped "JDepend" report (jdepend-maven-plugin:2.0:generate), file "jdepend-report.html" already exists.
[INFO] Rendering 21 report documents
[INFO] Generating "Checkstyle" report    --- maven-checkstyle-plugin:3.3.1:checkstyle
[INFO] Generating "CPD" report           --- maven-pmd-plugin:3.14.0:cpd
[INFO] Generating "PMD" report           --- maven-pmd-plugin:3.14.0:pmd
[INFO] Generating "Javadoc" report       --- maven-javadoc-plugin:3.6.3:javadoc
[INFO] Configuration changed, re-generating javadoc.
[INFO] Generating "SpotBugs" report      --- spotbugs-maven-plugin:4.8.5.0:spotbugs
[INFO] Generating "Dependencies" report  --- maven-project-info-reports-plugin:3.5.0:dependencies
[INFO] Generating "Dependency Information" report --- maven-project-info-reports-plugin:3.5.0:dependency-info
[INFO] Generating "Dependency Management" report --- maven-project-info-reports-plugin:3.5.0:dependency-management
[INFO] Generating "Distribution Management" report --- maven-project-info-reports-plugin:3.5.0:distribution-management
[INFO] Generating "About" report         --- maven-project-info-reports-plugin:3.5.0:index
[INFO] Generating "Issue Management" report --- maven-project-info-reports-plugin:3.5.0:issue-management
[INFO] Generating "Plugin Management" report --- maven-project-info-reports-plugin:3.5.0:plugin-management
[INFO] Generating "Plugins" report       --- maven-project-info-reports-plugin:3.5.0:plugins
[INFO] Generating "Summary" report       --- maven-project-info-reports-plugin:3.5.0:summary
[INFO] Generating "Source Xref" report   --- maven-jxr-plugin:3.3.2:jxr
[INFO] Generating "Test Source Xref" report --- maven-jxr-plugin:3.3.2:test-jxr
[INFO] Generating "Surefire" report      --- maven-surefire-report-plugin:3.2.5:report
[INFO] Generating "JaCoCo" report        --- jacoco-maven-plugin:0.8.7:report
[INFO] Loading execution data file XXXX\target\jacoco.exec
[INFO] Analyzed bundle 'CommonArch-Test' with 31 classes
[INFO] Generating "JDepend" report       --- jdepend-maven-plugin:2.0:generate-no-fork
[WARNING] An issue has occurred with jdepend-maven-plugin:2.0:generate-no-fork report, skipping LinkageError Method org/codehaus/mojo/jdepend/JDependNoForkMojo.generate(Lorg/apache/maven/doxia/sink/Sink;Ljava/util/Locale;)V is abstract, please report an issue to Maven dev team.
java.lang.AbstractMethodError: Method org/codehaus/mojo/jdepend/JDependNoForkMojo.generate(Lorg/apache/maven/doxia/sink/Sink;Ljava/util/Locale;)V is abstract
    at org.codehaus.mojo.jdepend.JDependNoForkMojo.generate (JDependNoForkMojo.java)
    at org.apache.maven.plugins.site.render.ReportDocumentRenderer.renderDocument (ReportDocumentRenderer.java:201)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render (DefaultSiteRenderer.java:300)
    at org.apache.maven.plugins.site.render.SiteMojo.renderNonDoxiaDocuments (SiteMojo.java:281)
    at org.apache.maven.plugins.site.render.SiteMojo.renderLocale (SiteMojo.java:146)
    at org.apache.maven.plugins.site.render.SiteMojo.execute (SiteMojo.java:111)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:342)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:330)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:175)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:76)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:163)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:160)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:910)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)

Not very surprising that the JDEpend-Report is not generated correctly with that warning

jdepend_report_fehlerhaft

Bukama commented 4 weeks ago

To be honest I'm not sure if this is a general Doxia/Site plugin issue, but after removing the JDepend Report-Dependency everything worked fine and we don't have any issues in all our other projects (which uses 4.0.0-Mx for a longer time but no JDepend. As the Mojo that throws the error is an JDepend Mojo according to message/stacktrace I decided to post it here (and after a quick question in Maven Slack)

ottlinger commented 1 week ago

I ran into a similar problem within apache-tentacles as well after I updated to maven-site-plugin 3.12.1 to 3.20.0:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.20.0:site (default-site) on project apache-tentacles: Failed to render site: Error generating jdepend-maven-plugin:2.0:generate-no-fork report: UndeclaredThrowableException: InvocationTargetException: Method org/codehaus/mojo/jdepend/JDependNoForkMojo.generate(Lorg/apache/maven/doxia/sink/Sink;Ljava/util/Locale;)V is abstract -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.20.0:site (default-site) on project apache-tentacles: Failed to render site
.....

Caused by: org.apache.maven.doxia.siterenderer.RendererException: Error generating jdepend-maven-plugin:2.0:generate-no-fork report
.....

Caused by: java.lang.AbstractMethodError: Method org/codehaus/mojo/jdepend/JDependNoForkMojo.generate(Lorg/apache/maven/doxia/sink/Sink;Ljava/util/Locale;)V is abstract
    at org.codehaus.mojo.jdepend.JDependNoForkMojo.generate (JDependNoForkMojo.java)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:77)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:568)
    at com.gradle.maven.cache.extension.h.b.lambda$createProxy$0 (SourceFile:82)

@slachiewicz Is the problem related to jdepend or a configuration issue? Thanks

ottlinger commented 1 week ago

@Bukama is the problem fixed with the current 2.1-SNAPSHOT? If so maybe a release can be done as the current situation (with v2.0) yields an empty report or a broken build. Thanks.

Bukama commented 1 week ago

@Bukama is the problem fixed with the current 2.1-SNAPSHOT? If so maybe a release can be done as the current situation (with v2.0) yields an empty report or a broken build. Thanks.

Hey, sadly I can't check as the SNAPSHOT is not available via Maven Central and cloning Github project is blocked by our security here :/ . As only dependencies from Maven Central and verified by our comapnies Nexus IQ servers can be used - is it possible to release a beta/RC or so? I have seen there are tags for beta versions of former versions.