Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
# spring-boot-dependency-checker

A small utility that finds manually overridden dependencies in a Maven POM (most accurate) or SBOM for a Spring Boot application.
A small utility that finds manually overridden dependencies in a Maven POM, Gradle file, or SBOM for a Spring Boot application.

## Usage

`npm install -g spring-boot-dependency-checker`

`spring-boot-dependency-checker location/to/pom.xml`

| File type | Dependencies | Properties | Accurate |
|-----------------|--------------|------------|----------|
| Maven POM | ✓ | ✓ | ✓ |
| Gradle - Groovy | ✓ | ✗ | ✓ |
| SBOM | ✓ | ✗ | ✗ |

Maven POM is the most accurate because it comes from the source file

Gradle - Groovy does not support overwritten properties because those generally come from a separate file

SBOM is accurate until you have dependencies that pull in newer versions that what Spring Boot recommends
39 changes: 1 addition & 38 deletions gradle.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,6 @@ export const getJSFromFile = async (filename) => {
}
};

// export const getGradleProperties = async (parsedGradle) => {
// const properties = parsedGradle.project?.properties;
// if (properties) {
// return Object.keys(properties);
// }
// return [];
// };
//
// const getSpringBootProperties = async (filename) => {
// await getSpringDefaultProperties(filename);
// return getJsonFromFile(`${cachePath}/properties_${filename}.json`);
// };

export const getGradleDependenciesWithVersions = async (parsedGradle) => {
if (Array.isArray(parsedGradle.dependencies)) {
return parsedGradle.dependencies.filter(dep => dep.version);
Expand All @@ -31,7 +18,7 @@ export const getGradleDependenciesWithVersions = async (parsedGradle) => {

export const getGradleSpringBootVersion = async (parsedGradle) => {
const springBootPlugin = parsedGradle?.plugins?.filter(plugin => plugin.id === 'org.springframework.boot');
if (Array.isArray(springBootPlugin) && springBootPlugin.length) {
if (Array.isArray(springBootPlugin) && springBootPlugin.length && springBootPlugin[0].version) {
return springBootPlugin[0].version;
}
console.log('No Spring Boot version found.');
Expand Down Expand Up @@ -63,27 +50,3 @@ export const retrieveSimilarGradlePackages = async (parsedGradle, springBootVers
}
}
};

// export const retrieveSimilarGradleProperties = async (parsedGradle, springBootVersion) => {
// const pomProperties = await getGradleProperties(parsedGradle);
// if (springBootVersion) {
// const defaultProperties = await getSpringBootProperties(springBootVersion);
//
// if (defaultProperties.length) {
// const declaredProperties = [];
// pomProperties.forEach(pomProperty => defaultProperties.forEach(defaultProperty => {
// if (pomProperty === defaultProperty.property) {
// declaredProperties.push(pomProperty);
// }
// }));
//
// console.log('Declared Gradle Properties Count -', declaredProperties.length);
// if (declaredProperties.length) {
// console.log('Declared Gradle Properties -', declaredProperties);
// }
// } else {
// console.log('Spring Boot default versions URL no longer exists.');
// }
// }
// };
//