Skip to content

Commit

Permalink
Sonatype Scan Gradle Plugin (#670)
Browse files Browse the repository at this point in the history
  • Loading branch information
micronaut-build authored Jan 9, 2025
1 parent 7d7d7ec commit 27447e6
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ jobs:
PREDICTIVE_TEST_SELECTION: "${{ github.event_name == 'pull_request' && 'true' || 'false' }}"
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OSS_INDEX_USERNAME: ${{ secrets.OSS_INDEX_USERNAME }}
OSS_INDEX_PASSWORD: ${{ secrets.OSS_INDEX_PASSWORD }}
steps:
# https://github.com/actions/virtual-environments/issues/709
- name: "🗑 Free disk space"
Expand Down Expand Up @@ -58,6 +60,11 @@ jobs:
run: |
[ -f ./setup.sh ] && ./setup.sh || [ ! -f ./setup.sh ]
- name: "🚔 Sonatype Scan"
id: sonatypescan
run: |
./gradlew ossIndexAudit --no-parallel --info
- name: "🛠 Build with Gradle"
id: gradle
run: |
Expand Down
8 changes: 8 additions & 0 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
plugins {
id 'groovy-gradle-plugin'
}

repositories {
mavenCentral()
}

dependencies {
implementation(libs.sonatype.scan)
}
8 changes: 7 additions & 1 deletion buildSrc/settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
rootProject.name = 'spring-parent'
dependencyResolutionManagement {
versionCatalogs {
libs {
from(files("../gradle/libs.versions.toml"))
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
plugins {
id 'io.micronaut.build.internal.spring-base'
id 'io.micronaut.build.internal.module'
id("org.sonatype.gradle.plugins.scan")
}
String ossIndexUsername = System.getenv("OSS_INDEX_USERNAME") ?: project.properties["ossIndexUsername"]
String ossIndexPassword = System.getenv("OSS_INDEX_PASSWORD") ?: project.properties["ossIndexPassword"]
boolean sonatypePluginConfigured = ossIndexUsername != null && ossIndexPassword != null
if (sonatypePluginConfigured) {
ossIndexAudit {
username = ossIndexUsername
password = ossIndexPassword
}
}

repositories {
Expand Down
3 changes: 2 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ micronaut-cache = "5.0.0"
micronaut-views = "5.6.0"
micronaut-validation = "4.8.0"
micronaut-servlet = "4.12.0"
sonatype-scan = "3.0.0"

[libraries]
# Micronaut
Expand Down Expand Up @@ -43,5 +44,5 @@ spring-boot-test = { module = 'org.springframework.boot:spring-boot-starter-test
spring-test = { module = 'org.springframework:spring-test', version.ref = 'managed-spring' }

spock-spring = { module = 'org.spockframework:spock-spring' }

sonatype-scan = { module = "org.sonatype.gradle.plugins:scan-gradle-plugin", version.ref = "sonatype-scan" }
h2database = { module = 'com.h2database:h2', version.ref = 'h2' }

0 comments on commit 27447e6

Please sign in to comment.