diff --git a/gradle.js b/gradle.js index 3c6ea53..197485d 100644 --- a/gradle.js +++ b/gradle.js @@ -27,6 +27,10 @@ export const getGradleSpringBootVersion = async (parsedGradle) => { // Handle build.gradle, which allows 3.2.+ format return springBootPlugin[0].version.replace('+', 'x'); } + // there are likely more places we could search for this variable, but we'll start here + if (parsedGradle?.buildscript?.ext?.springBootVersion) { + return String(parsedGradle?.buildscript?.ext?.springBootVersion).replace('+', 'x'); + } console.log('No Spring Boot version found.'); return ''; }; diff --git a/package-lock.json b/package-lock.json index 2f7e3d0..ea2a4f0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "spring-boot-dependency-checker", - "version": "0.3.0", + "version": "0.3.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "spring-boot-dependency-checker", - "version": "0.3.0", + "version": "0.3.1", "license": "\tGPL-3.0-or-later", "dependencies": { "fast-xml-parser": "^4.3.6", diff --git a/package.json b/package.json index b953dcc..e04327b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "spring-boot-dependency-checker", - "version": "0.3.0", + "version": "0.3.1", "description": "Spring Boot Dependency Checker - validate that you're using the versions Spring Boot has approved with your project.", "keywords": [ "spring boot", diff --git a/pom.js b/pom.js index ad8f638..e76b4e6 100644 --- a/pom.js +++ b/pom.js @@ -28,14 +28,13 @@ const getSpringBootProperties = async (filename) => { export const getPomDependenciesWithVersions = async (parsedPom) => { let allDependencies = []; - // if it's not an array, a single dependency has been declared and it doesn't apply - if (Array.isArray(parsedPom?.project?.dependencies?.dependency)) { - allDependencies = allDependencies.concat(parsedPom.project.dependencies.dependency.filter(dep => dep.version)); + if (parsedPom?.project?.dependencies?.dependency) { + allDependencies = allDependencies.concat(parsedPom.project.dependencies.dependency); } - if (Array.isArray(parsedPom?.project?.dependencyManagement?.dependencies?.dependency)) { - allDependencies = allDependencies.concat(parsedPom.project.dependencyManagement.dependencies.dependency.filter(dep => dep.version)); + if (parsedPom?.project?.dependencyManagement?.dependencies?.dependency) { + allDependencies = allDependencies.concat(parsedPom.project.dependencyManagement.dependencies.dependency); } - return allDependencies; + return allDependencies.filter(dep => dep.version); }; export const getPomSpringBootVersion = async (parsedPom) => {