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

--exclude-type doesn't work #1260

Closed
evyaroshevich opened this issue Jul 22, 2024 · 5 comments · Fixed by #1298
Closed

--exclude-type doesn't work #1260

evyaroshevich opened this issue Jul 22, 2024 · 5 comments · Fixed by #1298

Comments

@evyaroshevich
Copy link

After updating cdxgen to version 10.8.0+ and the addition of multi-module support, I can no longer exclude certain modules. I have a multi-project on Maven, but one of its submodules includes stub builds for Gradle and SBT. I am trying to use the parameters --exclude-type gradle --exclude-type sbt, but cdxgen ignores them.
Here is the full command: cdxgen --output sbom.json --noBanner --recurse --no-babel --exclude Dockerfile --exclude-type gradle --exclude-type sbt --required-only --timeout-ms 360000 --debug-mode debug --validate --include-formulation.

log:
Looking for project/build.properties
Looking for /builds/project/subproject1/build.properties
Detected sbt version: null
/root/.nvm/versions/node/v20.15.1/lib/node_modules/@cyclonedx/cdxgen/node_modules/semver/classes/semver.js:19
throw new TypeError(Invalid version. Must be a string. Got type "${typeof version}".)
^
TypeError: Invalid version. Must be a string. Got type "object".
at new SemVer (/root/.nvm/versions/node/v20.15.1/lib/node_modules/@cyclonedx/cdxgen/node_modules/semver/classes/semver.js:19:13)
at compare (/root/.nvm/versions/node/v20.15.1/lib/node_modules/@cyclonedx/cdxgen/node_modules/semver/functions/compare.js:3:3)
at gte (/root/.nvm/versions/node/v20.15.1/lib/node_modules/@cyclonedx/cdxgen/node_modules/semver/functions/gte.js:2:30)
at createJavaBom (file:///root/.nvm/versions/node/v20.15.1/lib/node_modules/@cyclonedx/cdxgen/index.js:2093:30)
at createMultiXBom (file:///root/.nvm/versions/node/v20.15.1/lib/node_modules/@cyclonedx/cdxgen/index.js:5462:23)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async createBom (file:///root/.nvm/versions/node/v20.15.1/lib/node_modules/@cyclonedx/cdxgen/index.js:6387:16)
at async file:///root/.nvm/versions/node/v20.15.1/lib/node_modules/@cyclonedx/cdxgen/bin/cdxgen.js:495:20
Node.js v20.15.1

@prabhu
Copy link
Collaborator

prabhu commented Jul 22, 2024

I don't think exclude-type is supported at a granular package manager level yet. Can you invoke with -t maven and share the output?

@evyaroshevich
Copy link
Author

@prabhu -t maven doesn't work. This setting also captures the gradle and sbt config files and breaks
image

@prabhu
Copy link
Collaborator

prabhu commented Jul 23, 2024

Thank you. Could you kindly share a project to reproduce the issue? Also test with the master branch.

@evyaroshevich
Copy link
Author

I can't provide my project for testing because, is commercial. To reproduce this error, you can take the project https://github.com/2much2learn/article_dec_28_mavengradle-based-multi-module-spring-boot-microservices.git there is a gradle and maven file. And with the -t maven option, it scans the gradle configuration too.
I have one script, cdxgen, that works on many of my projects, so I don’t want to include the -t maven option in the general script, because I have many different programming languages. I would like to exclude problem areas through the --exclude-type that break my CI/CD

@prabhu prabhu mentioned this issue Jul 23, 2024
@prabhu
Copy link
Collaborator

prabhu commented Jul 23, 2024

I have added some fixes as part of #1264. Non-trivial effort is required to support package manager level exclude, so will keep this issue open till there is some sponsorship or contributions.

@prabhu prabhu linked a pull request Aug 7, 2024 that will close this issue
@prabhu prabhu closed this as completed Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants