diff --git a/.github/workflows/continous-integration.yml b/.github/workflows/continous-integration.yml index 5b01c0a65..1af58923f 100644 --- a/.github/workflows/continous-integration.yml +++ b/.github/workflows/continous-integration.yml @@ -40,3 +40,29 @@ jobs: ${{ runner.os }}-gradle- - name: Build with Gradle Wrapper run: ./gradlew build --warning-mode=fail -Pmicronaut.runtime=${{ matrix.runtime }} + + spotbugs: + runs-on: ubuntu-latest + steps: + - name: Git Checkout + uses: actions/checkout@v2 + - name: Set up JDKs with Matrix Build + uses: actions/setup-java@v1 + with: + java-version: 8 + - name: Cache Dependencies #see https://github.com/actions/cache/blob/master/examples.md#java---gradle + uses: actions/cache@v2 + with: + path: ~/.gradle/caches + key: ${{ runner.os }}-spotbugs-gradle-${{ hashFiles('**/*.gradle*') }} + restore-keys: | + ${{ runner.os }}-spotbugs-gradle- + - name: spotbugs + id: spotbugs_checks + run: ./gradlew spotbugsMain + - name: publish spotbugs +# TODO switch to orignial GHA when PR jwgmeligmeyling/spotbugs-github-action#10 is integrated + uses: arolfes/spotbugs-github-action@master + with: + path: '**/spotbugs/*.xml' + threshold: 0 diff --git a/config/spotbugs/exclude.xml b/config/spotbugs/exclude.xml new file mode 100644 index 000000000..06693b7fa --- /dev/null +++ b/config/spotbugs/exclude.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/gradle.properties b/gradle.properties index e1acabe90..88e0c66a5 100644 --- a/gradle.properties +++ b/gradle.properties @@ -15,8 +15,9 @@ camundaVersion=7.14.0 # Latest Jersey, that implements JAX-RS 2.1 API: see https://eclipse-ee4j.github.io/jersey/download.html jerseyVersion=2.33 shadowJarVersion=6.1.0 +spotbugsVersion=4.6.0 # Prevent upload of maven-metadata.xml.sha256/sha512 files to oss.sonatype.org # see https://issues.sonatype.org/browse/OSSRH-53695?focusedCommentId=887733&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-887733 # see https://github.com/gradle/gradle/issues/11308#issuecomment-554317655 systemProp.org.gradle.internal.publish.checksums.insecure=true -org.gradle.parallel=true +org.gradle.parallel=true \ No newline at end of file diff --git a/micronaut-camunda-bpm-feature/build.gradle b/micronaut-camunda-bpm-feature/build.gradle index e2a5e2d18..1a1acced6 100644 --- a/micronaut-camunda-bpm-feature/build.gradle +++ b/micronaut-camunda-bpm-feature/build.gradle @@ -1,3 +1,4 @@ +import com.github.spotbugs.snom.Effort plugins { id("io.micronaut.library") id("java-library") @@ -6,6 +7,7 @@ plugins { id("org.jetbrains.kotlin.plugin.allopen") id("maven-publish") id("signing") + id("com.github.spotbugs") } group = "info.novatec" @@ -131,3 +133,22 @@ signing { configurations { testArtifacts } + +spotbugs { + ignoreFailures = true + effort = Effort.MAX + excludeFilter = file("${project.rootDir}/config/spotbugs/exclude.xml") +} +// Example to configure HTML report +spotbugsMain { + reports { + xml { + enabled = true + } + html { + enabled = false + destination = file("$buildDir/reports/spotbugs/main/spotbugs.html") + stylesheet = 'fancy-hist.xsl' + } + } +} \ No newline at end of file diff --git a/micronaut-camunda-bpm-feature/src/main/java/info/novatec/micronaut/camunda/bpm/feature/JettyServerCustomizer.java b/micronaut-camunda-bpm-feature/src/main/java/info/novatec/micronaut/camunda/bpm/feature/JettyServerCustomizer.java index a471a7758..85594e500 100644 --- a/micronaut-camunda-bpm-feature/src/main/java/info/novatec/micronaut/camunda/bpm/feature/JettyServerCustomizer.java +++ b/micronaut-camunda-bpm-feature/src/main/java/info/novatec/micronaut/camunda/bpm/feature/JettyServerCustomizer.java @@ -122,7 +122,7 @@ static class ServletContextInitializedListener implements ServletContextListener protected static final EnumSet DISPATCHER_TYPES = EnumSet.of(REQUEST); - protected static ServletContext servletContext; + protected ServletContext servletContext; @Override public void contextInitialized(ServletContextEvent sce) { diff --git a/settings.gradle b/settings.gradle index a1eb9b564..ba22a2a9f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -6,6 +6,7 @@ pluginManagement { id("com.github.johnrengelman.shadow") version "$shadowJarVersion" id("io.micronaut.application") version "$micronautApplicationPluginVersion" id("io.micronaut.library") version "$micronautLibraryPluginVersion" + id("com.github.spotbugs") version "$spotbugsVersion" } }