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

Do not log maven errors for multi-module projects by default #826

Merged
merged 1 commit into from
Jan 22, 2024
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
70 changes: 37 additions & 33 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1236,46 +1236,50 @@ export const createJavaBom = async (path, options) => {
maxBuffer: MAX_BUFFER
});
if (result.status !== 0 || result.error) {
console.error(result.stdout, result.stderr);
console.log(
"Resolve the above maven error. This could be due to the following:\n"
);
if (
result.stdout &&
(result.stdout.includes("Non-resolvable parent POM") ||
result.stdout.includes("points at wrong local POM"))
) {
console.log(
"1. Check if the pom.xml contains valid settings such `parent.relativePath` to make mvn command work from within the sub-directory."
);
} else if (
result.stdout &&
(result.stdout.includes("Could not resolve dependencies") ||
result.stdout.includes("no dependency information available"))
) {
// Our approach to recursively invoking the maven plugin for each sub-module is bound to result in failures
// These could be due to a range of reasons that are covered below.
if (pomFiles.length === 1 || DEBUG_MODE) {
console.error(result.stdout, result.stderr);
console.log(
"1. Try building the project with 'mvn package -Dmaven.test.skip=true' using the correct version of Java and maven before invoking cdxgen."
"Resolve the above maven error. This could be due to the following:\n"
);
} else if (
result.stdout &&
result.stdout.includes(
"Could not resolve target platform specification"
)
) {
if (
result.stdout &&
(result.stdout.includes("Non-resolvable parent POM") ||
result.stdout.includes("points at wrong local POM"))
) {
console.log(
"1. Check if the pom.xml contains valid settings such `parent.relativePath` to make mvn command work from within the sub-directory."
);
} else if (
result.stdout &&
(result.stdout.includes("Could not resolve dependencies") ||
result.stdout.includes("no dependency information available"))
) {
console.log(
"1. Try building the project with 'mvn package -Dmaven.test.skip=true' using the correct version of Java and maven before invoking cdxgen."
);
} else if (
result.stdout &&
result.stdout.includes(
"Could not resolve target platform specification"
)
) {
console.log(
"1. Some projects can be built only from the root directory. Invoke cdxgen with --no-recurse option"
);
} else {
console.log(
"1. Java version requirement: cdxgen container image bundles Java 21 with maven 3.9 which might be incompatible."
);
}
console.log(
"1. Some projects can be built only from the root directory. Invoke cdxgen with --no-recurse option"
"2. Private dependencies cannot be downloaded: Check if any additional arguments must be passed to maven and set them via MVN_ARGS environment variable."
);
} else {
console.log(
"1. Java version requirement: cdxgen container image bundles Java 21 with maven 3.9 which might be incompatible."
"3. Check if all required environment variables including any maven profile arguments are passed correctly to this tool."
);
}
console.log(
"2. Private dependencies cannot be downloaded: Check if any additional arguments must be passed to maven and set them via MVN_ARGS environment variable."
);
console.log(
"3. Check if all required environment variables including any maven profile arguments are passed correctly to this tool."
);
// Do not fall back to methods that can produce incomplete results when failOnError is set
options.failOnError && process.exit(1);
console.log(
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cyclonedx/cdxgen",
"version": "9.11.1",
"version": "9.11.2",
"description": "Creates CycloneDX Software Bill of Materials (SBOM) from source or container image",
"homepage": "http://github.com/cyclonedx/cdxgen",
"author": "Prabhu Subramanian <[email protected]>",
Expand Down
Loading