spotbugs / spotbugs-maven-plugin

Maven Mojo Plug-In to generate reports based on the SpotBugs Analyzer
https://spotbugs.github.io/spotbugs-maven-plugin/
Apache License 2.0
69 stars 50 forks source link

Build repeats "Unable to create Maven project for" warning and fails #760

Open delanym opened 2 months ago

delanym commented 2 months ago

With this configuration

      <build>
        <plugins>
          <plugin>
            <groupId>com.github.spotbugs</groupId>
            <artifactId>spotbugs-maven-plugin</artifactId>
            <version>4.8.3.0</version>
            <executions>
              <execution>
                <id>check</id>
                <phase>verify</phase>
                <goals>
                  <goal>check</goal>
                </goals>
              </execution>
            </executions>
            <configuration>
              <plugins>
                <plugin>
                  <groupId>com.h3xstream.findsecbugs</groupId>
                  <artifactId>findsecbugs-plugin</artifactId>
                  <version>${dep.findsecbugs-plugin}</version>
                </plugin>
                <plugin>
                  <groupId>com.mebigfatguy.sb-contrib</groupId>
                  <artifactId>sb-contrib</artifactId>
                  <version>${dep.sb-contrib}</version>
                </plugin>
              </plugins>
              <effort>less</effort>
              <threshold>high</threshold>
              <failOnError>false</failOnError>
              <htmlOutput>true</htmlOutput>
              <xmlOutput>false</xmlOutput>
              <excludeFilterFile>${build.root}/spotbugs-exclusions.xml</excludeFilterFile>
            </configuration>
          </plugin>
        </plugins>
      </build>
      <reporting>
        <plugins>
          <plugin>
            <groupId>com.github.spotbugs</groupId>
            <artifactId>spotbugs-maven-plugin</artifactId>
            <version>4.8.3.0</version>
            <configuration>
              <plugins>
                <plugin>
                  <groupId>com.h3xstream.findsecbugs</groupId>
                  <artifactId>findsecbugs-plugin</artifactId>
                  <version>${dep.findsecbugs-plugin}</version>
                </plugin>
                <plugin>
                  <groupId>com.mebigfatguy.sb-contrib</groupId>
                  <artifactId>sb-contrib</artifactId>
                  <version>${dep.sb-contrib}</version>
                </plugin>
              </plugins>
              <effort>less</effort>
              <threshold>high</threshold>
              <failOnError>false</failOnError>
              <htmlOutput>true</htmlOutput>
              <xmlOutput>false</xmlOutput>
              <excludeFilterFile>${build.root}/spotbugs-exclusions.xml</excludeFilterFile>
            </configuration>
          </plugin>
        </plugins>
      </reporting>

And this command run on a ~500 module project

./mvnw site -T1

(Apache Maven 3.9.5)

My build is taking ages and looks stuck

[WARNING] No project URL defined - site links will not be relativized!
[WARNING] Unable to create Maven project for clients:activationkeygenclient:jar:2.4.0-SNAPSHOT from repository.
[WARNING] Unable to create Maven project for clients:commissionerdotnet:jar:2.4.0-SNAPSHOT from repository.
[WARNING] Unable to create Maven project for common:jsonvalidatorcommon:jar:2.4.0-SNAPSHOT from repository.
[WARNING] Unable to create Maven project for transports:ibmmqtransport:jar:2.4.0-SNAPSHOT from repository.
     [java] The following classes needed for analysis were missing:
     [java]   makeConcatWithConstants
     [java]   apply
     [java] The following classes needed for analysis were missing:
     [java]   makeConcatWithConstants
     [java]   apply
[WARNING] Site model of 'msgfactories:tlvmsgfactory:jar:2.4.0-SNAPSHOT' for default locale is still using the old pre-version 2.0.0 model. You MUST migrate to the new model as soon as possible otherwise your build will break in the future!
[WARNING] Site model of 'msgfactories:msgfactories:pom:2.4.0-SNAPSHOT' for default locale is still using the old pre-version 2.0.0 model. You MUST migrate to the new model as soon as possible otherwise your build will break in the future!
[WARNING] No project URL defined - site links will not be relativized!
[WARNING] Unable to create Maven project for clients:activationkeygenclient:jar:2.4.0-SNAPSHOT from repository.
[WARNING] Unable to create Maven project for clients:commissionerdotnet:jar:2.4.0-SNAPSHOT from repository.
[WARNING] Unable to create Maven project for common:jsonvalidatorcommon:jar:2.4.0-SNAPSHOT from repository.
[WARNING] Unable to create Maven project for transports:ibmmqtransport:jar:2.4.0-SNAPSHOT from repository.
     [java] The following classes needed for analysis were missing:
     [java]   apply
     [java]   makeConcatWithConstants
     [java]   add
     [java]   get
     [java] The following classes needed for analysis were missing:
     [java]   apply
     [java]   makeConcatWithConstants
     [java]   add
     [java]   get
[WARNING] Site model of 'common:peripheralcommon:jar:2.4.0-SNAPSHOT' for default locale is still using the old pre-version 2.0.0 model. You MUST migrate to the new model as soon as possible otherwise your build will break in the future!
[WARNING] Site model of 'common:common:pom:2.4.0-SNAPSHOT' for default locale is still using the old pre-version 2.0.0 model. You MUST migrate to the new model as soon as possible otherwise your build will break in the future!
[WARNING] No project URL defined - site links will not be relativized!
[WARNING] Unable to create Maven project for clients:activationkeygenclient:jar:2.4.0-SNAPSHOT from repository.
[WARNING] Unable to create Maven project for clients:commissionerdotnet:jar:2.4.0-SNAPSHOT from repository.
[WARNING] Unable to create Maven project for common:jsonvalidatorcommon:jar:2.4.0-SNAPSHOT from repository.
[WARNING] Unable to create Maven project for transports:ibmmqtransport:jar:2.4.0-SNAPSHOT from repository.
     [java] The following classes needed for analysis were missing:
     [java]   makeConcatWithConstants
     [java]   apply
     [java] The following classes needed for analysis were missing:
     [java]   makeConcatWithConstants
     [java]   apply
[WARNING] Site model of 'chainedeventhandlers:morpho:jar:2.4.0-SNAPSHOT' for default locale is still using the old pre-version 2.0.0 model. You MUST migrate to the new model as soon as possible otherwise your build will break in the future!
[WARNING] Site model of 'chainedeventhandlers:chainedeventhandlers:pom:2.4.0-SNAPSHOT' for default locale is still using the old pre-version 2.0.0 model. You MUST migrate to the new model as soon as possible otherwise your build will break
in the future!
[WARNING] No project URL defined - site links will not be relativized!

Then fails with Execution default-site of goal org.apache.maven.plugins:maven-site-plugin:4.0.0-M13:site failed

     [java] Exception in thread "main" edu.umd.cs.findbugs.ba.AnalysisException: Exeption was thrown during analysis
     [java]     at edu.umd.cs.findbugs.FindBugs2.lambda$analyzeApplication$3(FindBugs2.java:1125)
     [java]     at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
     [java]     at edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:1118)
     [java]     at edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:309)
     [java]     at edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:395)
     [java]     at edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1231)
     [java] Caused by: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
     [java]     at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
     [java]     at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
     [java]     at edu.umd.cs.findbugs.FindBugs2.lambda$analyzeApplication$3(FindBugs2.java:1120)
     [java]     ... 5 more
     [java] Caused by: java.lang.OutOfMemoryError: Java heap space
     [java]     at java.base/java.util.ArrayList.<init>(ArrayList.java:156)
     [java]     at edu.umd.cs.findbugs.ba.Frame.<init>(Frame.java:113)
     [java]     at edu.umd.cs.findbugs.ba.vna.ValueNumberFrame.<init>(ValueNumberFrame.java:90)
     [java]     at edu.umd.cs.findbugs.ba.vna.ValueNumberAnalysis.createFact(ValueNumberAnalysis.java:180)
     [java]     at edu.umd.cs.findbugs.ba.vna.ValueNumberAnalysis.createFact(ValueNumberAnalysis.java:57)
     [java]     at edu.umd.cs.findbugs.ba.Dataflow.execute(Dataflow.java:320)
     [java]     at edu.umd.cs.findbugs.classfile.engine.bcel.ValueNumberDataflowFactory.analyze(ValueNumberDataflowFactory.java:76)
     [java]     at edu.umd.cs.findbugs.classfile.engine.bcel.ValueNumberDataflowFactory.analyze(ValueNumberDataflowFactory.java:46)
     [java]     at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.analyzeMethod(AnalysisCache.java:368)
     [java]     at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getMethodAnalysis(AnalysisCache.java:321)
     [java]     at edu.umd.cs.findbugs.classfile.engine.bcel.AnalysisFactory.getValueNumberDataflow(AnalysisFactory.java:118)
     [java]     at edu.umd.cs.findbugs.classfile.engine.bcel.LockDataflowFactory.analyze(LockDataflowFactory.java:59)
     [java]     at edu.umd.cs.findbugs.classfile.engine.bcel.LockDataflowFactory.analyze(LockDataflowFactory.java:38)
     [java]     at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.analyzeMethod(AnalysisCache.java:368)
     [java]     at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getMethodAnalysis(AnalysisCache.java:321)
     [java]     at edu.umd.cs.findbugs.ba.ClassContext.getMethodAnalysis(ClassContext.java:1010)
     [java]     at edu.umd.cs.findbugs.ba.ClassContext.getLockDataflow(ClassContext.java:559)
     [java]     at edu.umd.cs.findbugs.detect.StaticCalendarDetector.visitMethod(StaticCalendarDetector.java:225)
     [java]     at org.apache.bcel.classfile.Method.accept(Method.java:120)
     [java]     at edu.umd.cs.findbugs.visitclass.PreorderVisitor.doVisitMethod(PreorderVisitor.java:319)
     [java]     at edu.umd.cs.findbugs.visitclass.PreorderVisitor.visitJavaClass(PreorderVisitor.java:404)
     [java]     at org.apache.bcel.classfile.JavaClass.accept(JavaClass.java:249)
     [java]     at edu.umd.cs.findbugs.BytecodeScanningDetector.visitClassContext(BytecodeScanningDetector.java:38)
     [java]     at edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:76)
     [java]     at edu.umd.cs.findbugs.FindBugs2.lambda$analyzeApplication$1(FindBugs2.java:1108)
     [java]     at edu.umd.cs.findbugs.FindBugs2$$Lambda$114/0x00007f4e7022fac0.call(Unknown Source)
     [java]     at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
     [java]     at edu.umd.cs.findbugs.CurrentThreadExecutorService.execute(CurrentThreadExecutorService.java:86)
     [java]     at java.base/java.util.concurrent.AbstractExecutorService.invokeAll(AbstractExecutorService.java:247)
     [java]     at edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:1118)
     [java]     at edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:309)
     [java]     at edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:395)
hazendaz commented 2 months ago

I'd start by fixing the warnings that are from maven. For example, add a URL so its not getting that warning. Also look at your site.xml files to make sure those are correctly up to date. I don't think your issues are this plugin FWIW. I googled the issue and others have reported it against other plugins.

hazendaz commented 2 months ago

For the stack overflow I saw, see https://stackoverflow.com/questions/77426033/site-model-is-still-using-the-old-pre-version-2-0-0-model.

Do note, maven site plugin 4.x is not complete work from maven. Its in milestones (ie alpha at best). Its designed for maven 4 which also is not complete. While you can use maven site plugin 4.x with maven 3, understand it has bugs (I have at least two defects open) and its not an issue with this plugin or any other outside of what maven is doing. I would suggest if running into issues to use GA released items only at this time. The new version IMO doesn't have any real benefits otherwise.

While I started work on this plugin to move to site 2.0 xsd along with maven site plugin 4, the builds on that haven't worked and I've gave up trying for now. However, above issues you are facing are not what I see. Those indicate incorrect setup of requirements for maven.

hazendaz commented 2 months ago

To help see where I was, here is the work I've done for site4 thus far. https://github.com/spotbugs/spotbugs-maven-plugin/compare/master...spotbugs:spotbugs-maven-plugin:site4?expand=1. It has 2 failing tests. If I move doxia to 2.0.0-M9, it fails for most of them. Libs are all good with doxia 2.0.0-M9 update so likely some of the code. I use eclipse but groovy is having a fit right now and not showing me the source. If you want to try to work further on that give it a go.. Otherwise I suspect it will sit for a while.

delanym commented 2 months ago

I added a URL, license info, removed the custom site.xml and downgraded to 3.12.1 of the maven-site-plugin and that fixed a bunch of stuff (just not the "Unable to create Maven project for" warnings).

But I still get an OOM error, here running as a standalone goal

.\mvnw spotbugs:spotbugs

     [java] Exception in thread "main" edu.umd.cs.findbugs.ba.AnalysisException: Exeption was thrown during analysis
     [java]     at edu.umd.cs.findbugs.FindBugs2.lambda$analyzeApplication$3(FindBugs2.java:1125)
     [java]     at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
     [java]     at edu.umd.cs.findbugs.FindBugs2.analyzeApplication(FindBugs2.java:1118)
     [java]     at edu.umd.cs.findbugs.FindBugs2.execute(FindBugs2.java:309)
     [java]     at edu.umd.cs.findbugs.FindBugs.runMain(FindBugs.java:395)
     [java]     at edu.umd.cs.findbugs.FindBugs2.main(FindBugs2.java:1231)
     [java] Caused by: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError: Java heap space
     [java]     at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
     [java]     at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
     [java]     at edu.umd.cs.findbugs.FindBugs2.lambda$analyzeApplication$3(FindBugs2.java:1120)
     [java]     ... 5 more
     [java] Caused by: java.lang.OutOfMemoryError: Java heap space
     [java]     at org.apache.bcel.generic.ConstantPoolGen.getConstantPool(ConstantPoolGen.java:565)
     [java]     at org.apache.bcel.generic.FieldOrMethod.getSignature(FieldOrMethod.java:125)
     [java]     at org.apache.bcel.generic.InvokeInstruction.produceStack(InvokeInstruction.java:114)
     [java]     at edu.umd.cs.findbugs.ba.AbstractFrameModelingVisitor.getNumWordsProduced(AbstractFrameModelingVisitor.java:153)
     [java]     at edu.umd.cs.findbugs.ba.AbstractFrameModelingVisitor.handleNormalInstruction(AbstractFrameModelingVisitor.java:359)
     [java]     at edu.umd.cs.findbugs.ba.vna.ValueNumberFrameModelingVisitor.visitINVOKESTATIC(ValueNumberFrameModelingVisitor.java:389)
     [java]     at org.apache.bcel.generic.INVOKESTATIC.accept(INVOKESTATIC.java:63)
     [java]     at edu.umd.cs.findbugs.ba.AbstractFrameModelingVisitor.analyzeInstruction(AbstractFrameModelingVisitor.java:84)
     [java]     at edu.umd.cs.findbugs.ba.vna.ValueNumberAnalysis.transferInstruction(ValueNumberAnalysis.java:228)
     [java]     at edu.umd.cs.findbugs.ba.vna.ValueNumberAnalysis.transferInstruction(ValueNumberAnalysis.java:57)
     [java]     at edu.umd.cs.findbugs.ba.AbstractDataflowAnalysis.transfer(AbstractDataflowAnalysis.java:136)
     [java]     at edu.umd.cs.findbugs.ba.vna.ValueNumberAnalysis.transfer(ValueNumberAnalysis.java:214)
     [java]     at edu.umd.cs.findbugs.ba.vna.ValueNumberAnalysis.transfer(ValueNumberAnalysis.java:57)
     [java]     at edu.umd.cs.findbugs.ba.Dataflow.execute(Dataflow.java:378)
     [java]     at edu.umd.cs.findbugs.classfile.engine.bcel.ValueNumberDataflowFactory.analyze(ValueNumberDataflowFactory.java:76)
     [java]     at edu.umd.cs.findbugs.classfile.engine.bcel.ValueNumberDataflowFactory.analyze(ValueNumberDataflowFactory.java:46)
     [java]     at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.analyzeMethod(AnalysisCache.java:368)
     [java]     at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getMethodAnalysis(AnalysisCache.java:321)
     [java]     at edu.umd.cs.findbugs.classfile.engine.bcel.AnalysisFactory.getValueNumberDataflow(AnalysisFactory.java:118)
     [java]     at edu.umd.cs.findbugs.classfile.engine.bcel.LockDataflowFactory.analyze(LockDataflowFactory.java:59)
     [java]     at edu.umd.cs.findbugs.classfile.engine.bcel.LockDataflowFactory.analyze(LockDataflowFactory.java:38)
     [java]     at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.analyzeMethod(AnalysisCache.java:368)
     [java]     at edu.umd.cs.findbugs.classfile.impl.AnalysisCache.getMethodAnalysis(AnalysisCache.java:321)
     [java]     at edu.umd.cs.findbugs.ba.ClassContext.getMethodAnalysis(ClassContext.java:1010)
     [java]     at edu.umd.cs.findbugs.ba.ClassContext.getLockDataflow(ClassContext.java:559)
     [java]     at edu.umd.cs.findbugs.detect.StaticCalendarDetector.visitMethod(StaticCalendarDetector.java:225)
     [java]     at org.apache.bcel.classfile.Method.accept(Method.java:120)
     [java]     at edu.umd.cs.findbugs.visitclass.PreorderVisitor.doVisitMethod(PreorderVisitor.java:319)
     [java]     at edu.umd.cs.findbugs.visitclass.PreorderVisitor.visitJavaClass(PreorderVisitor.java:404)
     [java]     at org.apache.bcel.classfile.JavaClass.accept(JavaClass.java:249)
     [java]     at edu.umd.cs.findbugs.BytecodeScanningDetector.visitClassContext(BytecodeScanningDetector.java:38)
     [java]     at edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:76)
hazendaz commented 2 months ago

Did prior versions work? Is it possible you can create a reproducible project that demonstrates the issue?