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

benchmarks: moves dependency scope to test #1422

Merged
merged 1 commit into from
Mar 5, 2024
Merged

Conversation

codefromthecrypt
Copy link
Member

@codefromthecrypt codefromthecrypt commented Mar 5, 2024

This moves the dependency scope of all JMH dependencies to test. This classifies them more accurately as test dependencies, which automatically excludes them from Trivy output.

Following aquasecurity/trivy#6213, we have a completely clean run, so no more complaints about old spring etc.

$ ../trivy/main repo .
2024-03-05T14:03:21.104+0800	INFO	Vulnerability scanning is enabled
2024-03-05T14:03:21.104+0800	INFO	Secret scanning is enabled
2024-03-05T14:03:21.104+0800	INFO	If your scanning is slow, please try '--scanners vuln' to disable secret scanning
2024-03-05T14:03:21.104+0800	INFO	Please see also https://aquasecurity.github.io/trivy/dev/docs/scanner/secret/#recommendation for faster secret detection
2024-03-05T14:05:38.862+0800	INFO	Number of language-specific files: 66
2024-03-05T14:05:38.862+0800	INFO	Detecting pom vulnerabilities...

maven-shade-plugin doesn't really like this setup, despite having a shadeTestJar flag, I was unable to get any configuration to work which included dependencies. The easier path was to declare a maven assembly for what is a generic test jar (including dependencies), and then use the assembly plugin instead of shade. This exact setup can be copy/pasta'd to any of our other projects.

At the end of the day, the same jar as before is created, so instructions are the same. The main con is that that jar is bigger as it also includes default test deps like assertj. However, I feel trying to be precise on this is a cure worse than the disease as few if any use this thing anyway.

From the project directory, run this to build the benchmarks:

```bash
$ ./mvnw install -pl instrumentation/benchmarks -am -Dmaven.test.skip.exec=true`
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ps the docs are the same as before except fixing this glitch. in the parent pom, the benchmarks module is removed when -DskipTests, so basically it was a broken doc.

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 this pull request may close these issues.

2 participants