title: Spot bugs / Maven build in multi module project
body: <p>During adding spotbugs to my multi module project I've got an issue:<br />
  <code>Failed to execute goal on project %X: Could not resolve dependencies for project %X:war:1.0.1-SNAPSHOT: Failure to find %Y. 1-SNAPSHOT in https://repository.apache.org/content/repositories/snapshots/ was cached in the local repository, resolution will not be reattempted until the update interval of apache.snapshots has elapsed or updates are forced -&gt; [Help 1]</code></p>
  <p>Where:<br />
  %X - module 1 it depends on module 2 (%Y)<br />
  %Y - module 2 (.jar library) needed for module 1 (%X)</p>
  <p>perent pom.xml:</p>
  <pre><code>    &lt;artifactId&gt;myProj&lt;/artifactId&gt;
      &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;pom&lt;/packaging&gt;
      &lt;modules&gt;
          &lt;module&gt;%X&lt;/module&gt;
          &lt;module&gt;%Y&lt;/module&gt;
      &lt;/modules&gt;
  
         ...
  
      &lt;build&gt;
          &lt;pluginManagement&gt;
              &lt;plugins&gt;
                  &lt;plugin&gt;
                      &lt;groupId&gt;com.github.spotbugs&lt;/groupId&gt;
                      &lt;artifactId&gt;spotbugs-maven-plugin&lt;/artifactId&gt;
                      &lt;version&gt;4.0.4&lt;/version&gt;
                      &lt;dependencies&gt;
                          &lt;!-- overwrite dependency on spotbugs if you want to specify the version of spotbugs --&gt;
                          &lt;dependency&gt;
                              &lt;groupId&gt;com.github.spotbugs&lt;/groupId&gt;
                              &lt;artifactId&gt;spotbugs&lt;/artifactId&gt;
                              &lt;version&gt;4.1.2&lt;/version&gt;
                          &lt;/dependency&gt;
                      &lt;/dependencies&gt;
                  &lt;/plugin&gt;
              &lt;/plugins&gt;
          &lt;/pluginManagement&gt;
      &lt;/build&gt;
  </code></pre>
  <p>child module pom.xml:</p>
  <pre><code>&lt;parent&gt;
          &lt;groupId&gt;my.project&lt;/groupId&gt;
          &lt;artifactId&gt;myProj&lt;/artifactId&gt;
          &lt;relativePath&gt;../pom.xml&lt;/relativePath&gt;
          &lt;version&gt;1.0.0-SNAPSHOT&lt;/version&gt;
      &lt;/parent&gt;
  
      &lt;artifactId&gt;%X&lt;/artifactId&gt;
      &lt;version&gt;1.0.1-SNAPSHOT&lt;/version&gt;
      &lt;packaging&gt;war&lt;/packaging&gt;
  
      &lt;name&gt;%X&lt;/name&gt;
  
         .....
  
        &lt;build&gt;
          &lt;finalName&gt;%X&lt;/finalName&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;groupId&gt;com.github.spotbugs&lt;/groupId&gt;
                  &lt;artifactId&gt;spotbugs-maven-plugin&lt;/artifactId&gt;
              &lt;/plugin&gt;
                         ..........
       &lt;/build&gt;
  </code></pre>
  <p>Then I execute commands in next order:<br />
  <code>&gt;mvn clean compile </code> - project compiled as normally<br />
  <code>&gt;mvn spotbugs:spotbugs</code> - error outputted</p>
  <p>Also tried:</p>
  <ol>
  <li>Executing <code>clean compile with -U</code></li>
  <li>Deleting artifacts from my local maven repo</li>
  <li>Adding plugin only in my child module and executing <code>mvn spotbugs:spotbugs -pl :%X</code></li>
  <li>Step followed next guide <a href="https://spotbugs.github.io/spotbugs-maven-plugin/examples/multi-module-config.html" rel="nofollow noreferrer">[link]</a></li>
  <li>Checked IntelliJ plugin, it works</li>
  </ol>
  <p>So the question is: How to start it correctly? :)</p>
  <p>P.S. Does spotbugs have some resriction in code analysis? I'm trying to use it on a legacy project so maybe because of that I have troubles<br />
  P.S.S. I'v tried it on my other project that has no &quot;childs&quot; and it used (let's say) latest  technologies all work corectly.</p>
  <hr />
  <p>Updated:
  Tried execute <code>maven clean install -pl :%Y</code> and now I got other error. Also tried to exclude &quot;apache org&quot; and have same errors
  Stack-trace:</p>
  <pre><code>[INFO] 
  [INFO] --- spotbugs-maven-plugin:4.0.4:spotbugs (default-cli) @ myProject ---
  [INFO] Fork Value is true
       [java] Exception in thread &quot;main&quot; 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.util.ArrayList.forEach(ArrayList.java:1257)
       [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: GC overhead limit exceeded
       [java]     at java.util.concurrent.FutureTask.report(FutureTask.java:122)
       [java]     at java.util.concurrent.FutureTask.get(FutureTask.java:192)
       [java]     at edu.umd.cs.findbugs.FindBugs2.lambda$analyzeApplication$3(FindBugs2.java:1120)
       [java]     ... 5 more
       [java] Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
       [java]     at java.util.HashMap.resize(HashMap.java:704)
       [java]     at java.util.HashMap.putVal(HashMap.java:629)
       [java]     at java.util.HashMap.put(HashMap.java:612)
       [java]     at java.util.HashSet.add(HashSet.java:220)
       [java]     at java.util.AbstractCollection.addAll(AbstractCollection.java:344)
       [java]     at java.util.HashSet.&lt;init&gt;(HashSet.java:120)
       [java]     at edu.umd.cs.findbugs.ba.deref.UnconditionalValueDerefSet.cleanDerefSet(UnconditionalValueDerefSet.java:407)
       [java]     at edu.umd.cs.findbugs.ba.deref.UnconditionalValueDerefAnalysis.propagateDerefSetsToMergeInputValues(UnconditionalValueDerefAnalysis.java:881)
       [java]     at edu.umd.cs.findbugs.ba.deref.UnconditionalValueDerefAnalysis.meetInto(UnconditionalValueDerefAnalysis.java:728)
       [java]     at edu.umd.cs.findbugs.ba.Dataflow.execute(Dataflow.java:345)
       [java]     at edu.umd.cs.findbugs.classfile.engine.bcel.UnconditionalValueDerefDataflowFactory.analyze(UnconditionalValueDerefDataflowFactory.java:82)
       [java]     at edu.umd.cs.findbugs.classfile.engine.bcel.UnconditionalValueDerefDataflowFactory.analyze(UnconditionalValueDerefDataflowFactory.java:41)
       [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:995)
       [java]     at edu.umd.cs.findbugs.ba.ClassContext.getUnconditionalValueDerefDataflow(ClassContext.java:837)
       [java]     at edu.umd.cs.findbugs.detect.BuildUnconditionalParamDerefDatabase.analyzeMethod(BuildUnconditionalParamDerefDatabase.java:118)
       [java]     at edu.umd.cs.findbugs.detect.BuildUnconditionalParamDerefDatabase.considerMethod(BuildUnconditionalParamDerefDatabase.java:107)
       [java]     at edu.umd.cs.findbugs.detect.BuildUnconditionalParamDerefDatabase.visitClassContext(BuildUnconditionalParamDerefDatabase.java:91)
       [java]     at edu.umd.cs.findbugs.DetectorToDetector2Adapter.visitClass(DetectorToDetector2Adapter.java:76)
       [java]     at edu.umd.cs.findbugs.FindBugs2.lambda$null$1(FindBugs2.java:1108)
       [java]     at edu.umd.cs.findbugs.FindBugs2$$Lambda$18/1193894341.call(Unknown Source)
       [java]     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
       [java]     at edu.umd.cs.findbugs.CurrentThreadExecutorService.execute(CurrentThreadExecutorService.java:86)
       [java]     at java.util.concurrent.AbstractExecutorService.invokeAll(AbstractExecutorService.java:238)
       [java]     ... 4 more
  
  </code></pre>