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

Gradle support #15

Closed
henrik242 opened this issue Nov 7, 2016 · 12 comments
Closed

Gradle support #15

henrik242 opened this issue Nov 7, 2016 · 12 comments

Comments

@henrik242
Copy link
Contributor

How do I integrate spotbugs in Gradle?

@jsotuyod
Copy link
Member

jsotuyod commented Nov 7, 2016

Right now SpotBugs has no releases. We plan on making a 3.1.0 release with improved Java 8 support ASAP.

Once released, you will be able to use SpotBugs by using the Gradle FindBugs plugin, and simply swapping FindBugs with SpotBugs by adding to your build.gradle:

configurations {
  findbugs {
    exclude group:'com.google.code.findbugs', module:'findbugs'
  }
}
dependencies {
  findbugs 'com.github.spotbugs:spotbugs:3.1.0'
}

That way you achieve the desired result.

./gradlew -q :commons:dependencies --configuration findbugs

------------------------------------------------------------
Project :commons
------------------------------------------------------------

findbugs - The FindBugs libraries to be used for this project.
\--- com.github.spotbugs:spotbugs:3.1.0

Non the less, we are talking with the Gradle dev team to get official support from them on future Gradle releases.

Once released, we will add these instructions to the website, as stated in #5

@henrik242
Copy link
Contributor Author

Thanks!

@henrik242
Copy link
Contributor Author

henrik242 commented Nov 30, 2016

Since #38 and #39 are fixed, I guess this can be closed

@jsotuyod jsotuyod mentioned this issue Jan 27, 2017
21 tasks
@KengoTODA
Copy link
Member

Maybe we can send PR to this package, to add SpotBugs gradle plugin.

@jsotuyod
Copy link
Member

Maybe, but with findbugs dead they may want to simply rework what they have.

In the meantime, what I wrote for #15 (comment) should work just fine, even for older gradle versions.

@johnscancella
Copy link
Contributor

I tried the suggested change in the #15 (comment)

but it still will not run correctly, here is the error I am seeing in gradle

* What went wrong:
Execution failed for task ':findbugsMain'.
> Unable to infer the version of FindBugs from currently specified FindBugs classpath: [spotbugs-3.1.0-RC1.jar, asm-debug-all-6.0_ALPHA.jar, jcip-annotations-1.0.jar, dom4j-1.6.1.jar, commons-lang-2.6.jar, jaxen-1.1.6.jar, jdepend-2.9.1.jar, jFormatString-3.0.0.jar, spotbugs-annotations-3.1.0-RC1.jar, xml-apis-1.0.b2.jar, jsr305-3.0.1.jar]

@jsotuyod
Copy link
Member

@johnscancella mmm... Gradle seems to be really hardwired, I didn't recall them doing this....

It seems we will need a custom plugin until Gradle officially switches after all....

@johnscancella
Copy link
Contributor

@jsotuyod I am happy to provide a pull request for a custom plugin

@KengoTODA
Copy link
Member

@johnscancella When you add a custom plugin, please consider to update this document at the same time.
https://github.com/spotbugs/spotbugs/blob/master/docs/migration.rst#findbugs-gradle-plugin

Then we can host updated migration guide at ReadTheDocs.

@jsotuyod
Copy link
Member

@johnscancella can't wait for it! Thanks!

@johnscancella
Copy link
Contributor

@jsotuyod see #142
not completely done but it is a good first start. You would still need to sign up for an account from gradle so you can upload the plugin to them.

@jsotuyod
Copy link
Member

@johnscancella yeah, don't worry. I already have one as the author of https://github.com/monits/static-code-analysis-plugin.

Amazing job!

ThrawnCA added a commit that referenced this issue Sep 4, 2017
- resolves #82
- using Spotbugs to check itself would be better but needs appropriate Gradle plugin,
see gradle/gradle#2538 and #15
henrik242 pushed a commit that referenced this issue Sep 4, 2017
- resolves #82
- using Spotbugs to check itself would be better but needs appropriate Gradle plugin,
see gradle/gradle#2538 and #15
KengoTODA pushed a commit to KengoTODA/spotbugs that referenced this issue Sep 7, 2017
- resolves spotbugs#82
- using Spotbugs to check itself would be better but needs appropriate Gradle plugin,
see gradle/gradle#2538 and spotbugs#15
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

4 participants