rules_jvm_external icon indicating copy to clipboard operation
rules_jvm_external copied to clipboard

java.lang.ClassNotFoundException: edu.umd.cs.findbugs.LaunchAppropriateUI from spotbugs with rules_jvm_external release 6.3

Open nlou9 opened this issue 1 year ago • 0 comments

Description: We upgrade to release 6.3 and we got error java.lang.ClassNotFoundException: edu.umd.cs.findbugs.LaunchAppropriateUI from spotbugs. It looks this commit causes the issue.

We are able to reproduce it with a minimal configuration.

rules_jvm_external version: 6.3 rules_jvm version: 0.24.0

WORKSPACE.bazel

maven_install(
    artifacts = [
        "com.github.spotbugs:spotbugs:4.8.0",
        "com.github.spotbugs:spotbugs-annotations:4.8.0"
    ],
    fetch_sources = True,
    maven_install_json = "@//:maven_install.json",
    repositories = [
     ......
    ],
    use_credentials_from_home_netrc_file = True,
    version_conflict_policy = "pinned",
)

BUILD.bazel

load("@contrib_rules_jvm//java:defs.bzl", "spotbugs_binary", "spotbugs_config")
spotbugs_binary(
    name = "spotbugs_bin",
    runtime_deps = ["@maven//:com_github_spotbugs_spotbugs"],
)
$bazel run //:spotbugs_bin
pip_login: login credential still valid: To force a token refresh, use the -f flag
Regenerating ~/.m2/settings.xml
Regenerating ~/.gradle/gradle.properties
maven_login ok
WARNING: Running Bazel server needs to be killed, because the startup options are different.
Starting local Bazel server and connecting to it...
INFO: Invocation ID: 821b3105-bbd9-4324-97df-98f2ec5823e9
INFO: Analyzed target //:spotbugs_bin (128 packages loaded, 1030 targets configured).
INFO: Found 1 target...
Target //:spotbugs_bin up-to-date:
  bazel-bin/spotbugs_bin
  bazel-bin/spotbugs_bin.jar
INFO: Elapsed time: 10.802s, Critical Path: 4.23s
INFO: 65 processes: 2 disk cache hit, 7 internal, 52 darwin-sandbox, 4 worker.
INFO: Build completed successfully, 65 total actions
INFO: Running command line: bazel-bin/spotbugs_bin
Error: Could not find or load main class edu.umd.cs.findbugs.LaunchAppropriateUI
Caused by: java.lang.ClassNotFoundException: edu.umd.cs.findbugs.LaunchAppropriateUI

I found that the rules_jvm_external release 6.3 adds feature to support pom. After we upgrade and run bazel run @unpinned_maven//:pin, it removed the com.github.spotbugs:spotbugs from the packages section of maven_install.json.

edu.umd.cs.findbugs.LaunchAppropriateUI should in edu.umd.cs.findbugs.launchGUI. Can you help to take a look why package com.github.spotbugs:spotbugs got removed?

package info in maven_install.json before upgrade

    "com.github.spotbugs:spotbugs": [
      "edu.umd.cs.findbugs",
      "edu.umd.cs.findbugs.asm",
      "edu.umd.cs.findbugs.ba",
      "edu.umd.cs.findbugs.ba.bcp",
      "edu.umd.cs.findbugs.ba.ca",
      "edu.umd.cs.findbugs.ba.ch",
      "edu.umd.cs.findbugs.ba.constant",
      "edu.umd.cs.findbugs.ba.deref",
      "edu.umd.cs.findbugs.ba.generic",
      "edu.umd.cs.findbugs.ba.heap",
      "edu.umd.cs.findbugs.ba.interproc",
      "edu.umd.cs.findbugs.ba.jsr305",
      "edu.umd.cs.findbugs.ba.npe",
      "edu.umd.cs.findbugs.ba.obl",
      "edu.umd.cs.findbugs.ba.type",
      "edu.umd.cs.findbugs.ba.vna",
      "edu.umd.cs.findbugs.bcel",
      "edu.umd.cs.findbugs.bcel.generic",
      "edu.umd.cs.findbugs.bugReporter",
      "edu.umd.cs.findbugs.bytecode",
      "edu.umd.cs.findbugs.charsets",
      "edu.umd.cs.findbugs.classfile",
      "edu.umd.cs.findbugs.classfile.analysis",
      "edu.umd.cs.findbugs.classfile.engine",
      "edu.umd.cs.findbugs.classfile.engine.asm",
      "edu.umd.cs.findbugs.classfile.engine.bcel",
      "edu.umd.cs.findbugs.classfile.impl",
      "edu.umd.cs.findbugs.config",
      "edu.umd.cs.findbugs.cwe",
      "edu.umd.cs.findbugs.detect",
      "edu.umd.cs.findbugs.filter",
      "edu.umd.cs.findbugs.graph",
      "edu.umd.cs.findbugs.gui",
      "edu.umd.cs.findbugs.gui2",
      "edu.umd.cs.findbugs.internalAnnotations",
      "edu.umd.cs.findbugs.io",
      "edu.umd.cs.findbugs.jaif",
      "edu.umd.cs.findbugs.launchGUI",
      "edu.umd.cs.findbugs.log",
      "edu.umd.cs.findbugs.model",
      "edu.umd.cs.findbugs.plan",
      "edu.umd.cs.findbugs.plugins",
      "edu.umd.cs.findbugs.props",
      "edu.umd.cs.findbugs.sarif",
      "edu.umd.cs.findbugs.sourceViewer",
      "edu.umd.cs.findbugs.util",
      "edu.umd.cs.findbugs.visitclass",
      "edu.umd.cs.findbugs.workflow",
      "edu.umd.cs.findbugs.xml"
    ],

nlou9 avatar Sep 13 '24 21:09 nlou9