Spotbugs: How to build spotbugs from src instead of using binary distribution

Created on 6 Jul 2018  路  6Comments  路  Source: spotbugs/spotbugs

How to build spotbugs from src instead of using bin distribution?I have seen the official documents but only found the way to use bin/spotbugs directly.
I have tried to access into spotbugs/spotbugs and run ../gradlew clean build . After that I got a Spotbugs.jar(3.4M).Then I replace it to the binary distribution(lib/) but cannot excute spotbugs.
Thanks!

Most helpful comment

@thrawnCA I guess that it's CLASSPATH problem. SpotBugs jar needs related libraries in the specific path. Instead of the jar file in build/libs, unzip zip file build/distributions file and use jar file in it.

All 6 comments

Normally you would integrate SpotBugs with your build tool of choice. The source tree includes Ant tasks and a Gradle plugin, and there are plugins for Maven and Eclipse.

That said, yes there is a shell script in spotbugs/bin that doesn't seem to be working...possibly hasn't been since we forked FindBugs? I'll take a look if I find time.

@thrawnCA I guess that it's CLASSPATH problem. SpotBugs jar needs related libraries in the specific path. Instead of the jar file in build/libs, unzip zip file build/distributions file and use jar file in it.

Shell script works fine.

@KengoTODA Thanks for your attention! I have unziped zip file build/distributions/spotbugs-3.1.6-SNAPSHOT.zip and access into bin.then run ./spotbugbut raise an error:cannot load main class 2.lib.buggy.icns
then replace jar belong to the directory mentioned above. got an Exception in thread "main" java.lang.NoClassDefFoundError: org/objectweb/asm/tree/ClassNode which is the same as replacing lib/spotbugs.jar(3.4M)

@ThrawnCA Thank you! I have successfully debug the src code in eclipse so I guess the code is ok. I want to know how the core works and maybe change something.But I stuck in rebuild the project and get the spotbugs.jar to work fine.

@iloveeclipse Do you mean the shell script in spotbugs/spotbugs/build/bin or spotbugs/spotbugs/build/distribution/spotbugs-3.1.6-SNAPSHOT/bin?

Was this page helpful?
0 / 5 - 0 ratings