Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails (Task :archunit:javadoc) #305

Closed
kamer opened this issue Feb 3, 2020 · 4 comments
Closed

Build fails (Task :archunit:javadoc) #305

kamer opened this issue Feb 3, 2020 · 4 comments

Comments

@kamer
Copy link

kamer commented Feb 3, 2020

Hello! I have cloned the project to contribute and tried to build following the Contributing Guide. But it fails as below. It's the first time I'm using Gradle so I couldn't do anything aside from Googling it and changing Java versions.

  • Linux 5.4.6-2-MANJARO
    I tried with:
  • openjdk 13.0.1 2019-10-15 (It outputs unsupported class file error)
  • openjdk 10.0.2 2018-07-17
  • oracle java 9.0.4
javadoc: error - An exception occurred while building a component: TagInfo
	(java.lang.NullPointerException)
Please file a bug against the javadoc tool via the Java bug reporting page
(http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com)
for duplicates. Include error messages and the following diagnostic in your report. Thank you.
java.lang.NullPointerException
	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.getEnclosingTypeElement(Utils.java:2574)
	at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.CommentHelper.getReferencedClass(CommentHelper.java:371)
    ...
    ... [I removed this part intentionally.]
    ...
 
1 error

> Task :archunit:javadoc FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':archunit:javadoc'.
> Javadoc generation failed. Generated Javadoc options file (useful for troubleshooting): '/home/kamer/downloads/ArchUnit/archunit/build/tmp/javadoc/javadoc.options'

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 10s
34 actionable tasks: 29 executed, 5 up-to-date

Running it with --stacktrace gives some additional info:

> Task :archunit-example:example-plain:compileJava FAILED
/home/kamer/downloads/ArchUnit/archunit-example/example-plain/src/main/java/com/tngtech/archunit/example/plantuml/importer/ProductImport.java:8: error: error while writing ProductImport: /home/kamer/downloads/ArchUnit/archunit-example/example-plain/build/classes/java/main/com/tngtech/archunit/example/plantuml/importer/ProductImport.class
public class ProductImport {
       ^
1 error

> Task :archunit:compileJava FAILED
/home/kamer/downloads/ArchUnit/archunit/src/main/java/com/tngtech/archunit/base/ReflectionUtils.java:23: error: error while writing ReflectionUtils: /home/kamer/downloads/ArchUnit/archunit/build/classes/java/main/com/tngtech/archunit/base/ReflectionUtils.class
public class ReflectionUtils {
       ^
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 error

FAILURE: Build completed with 2 failures.

1: Task failed with an exception.
`
@hankem
Copy link
Member

hankem commented Feb 4, 2020

First of all, thanks for your interest to contribute to ArchUnit! 😃

Issues

JDK 9 / 10

I can confirm the issues with Java 9 and 10, but note the following message:

Please file a bug against the javadoc tool via the Java bug reporting page

So this is indeed a JDK issue – which has been fixed in newer versions, but I guess that this fix won't be backported to JDK 9 or 10.

JDK 13

Regarding the issues with JDK 13: With openjdk-13.0.2, I'm also getting (tons of errors like)

> Task :archunit:spotbugsMain
The following errors occurred during analysis:
  Error scanning java/lang/Object for referenced classes
    java.lang.IllegalArgumentException: Unsupported class file major version 57
      At org.objectweb.asm.ClassReader.<init>(ClassReader.java:176)
      At org.objectweb.asm.ClassReader.<init>(ClassReader.java:158)
      At org.objectweb.asm.ClassReader.<init>(ClassReader.java:146)
      At edu.umd.cs.findbugs.asm.FBClassReader.<init>(FBClassReader.java:35)
      At edu.umd.cs.findbugs.classfile.engine.asm.ClassReaderAnalysisEngine.analyze(ClassReaderAnalysisEngine.java:48)
      At edu.umd.cs.findbugs.classfile.engine.asm.ClassReaderAnalysisEngine.analyze(ClassReaderAnalysisEngine.java:34)
      At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:262)
      At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:75)
      At edu.umd.cs.findbugs.classfile.engine.ClassInfoAnalysisEngine.analyze(ClassInfoAnalysisEngine.java:38)
      At edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getClassAnalysis(AnalysisCache.java:262)
      At edu.umd.cs.findbugs.FindBugs2.buildReferencedClassSet(FindBugs2.java:774)
      At edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:220)
      At com.github.spotbugs.internal.spotbugs.SpotBugsExecuter.runSpotbugs(SpotBugsExecuter.java:23)

I believe that we need to update spotbugs in order to support building ArchUnit with JDK ≥13 (the same was needed to support JDK 11 with #119), and that this, in turn, requires the gradle update of #192.

Workaround

So for the time being, you could either

  • use (Open)JDK 11 or 12 (preferred), or
  • use (Open)JDK 13 and locally skip spotbugs, e.g. by (temporarily) removing the following line in build-steps/build-steps.gradle:
 def utilsPath = { "build-steps/${it}" }
 
 apply from: utilsPath('archiving/archiving.gradle')
-apply from: utilsPath('codequality/spotbugs.gradle')
 apply from: utilsPath('release/publish.gradle')
 apply from: utilsPath('license/license.gradle')
 apply from: utilsPath('maven-integration-test/maven-integration-test.gradle')

@kamer
Copy link
Author

kamer commented Feb 4, 2020

@hankem Thank you for detailed answer. It works fine with JDK11.

@kamer kamer closed this as completed Feb 4, 2020
@hankem
Copy link
Member

hankem commented Feb 4, 2020

It turns out that #306 (Gradle 5.6.4) is not enough to use JDK 13, but that Gradle 6 is required (cf. gradle/gradle#10785).

@codecholeric
Copy link
Collaborator

Yes, I've noticed that, too. Our path should be to merge #284, then see how we get to Gradle 6 as quickly as possible. Unfortunately we have accumulated some technical dept with respect to the build ☹️

codecholeric pushed a commit that referenced this issue Feb 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants