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
20 changes: 10 additions & 10 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
Expand Up @@ -121,7 +121,7 @@
"snyk-go-plugin": "1.23.0",
"snyk-gradle-plugin": "5.0.1",
"snyk-module": "3.1.0",
"snyk-mvn-plugin": "3.8.3",
"snyk-mvn-plugin": "3.9.0",
"snyk-nodejs-lockfile-parser": "1.60.1",
"snyk-nodejs-plugin": "1.4.4",
"snyk-nuget-plugin": "2.7.15",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>

<groupId>io.snyk.example</groupId>
<artifactId>verbose-project</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Verbose project</name>
<description>Test project for the Maven CLI plugin with omit</description>

<properties>
<axis.version>1.4</axis.version>
</properties>

<dependencies>

<dependency>
<groupId>axis</groupId>
<artifactId>axis</artifactId>
<version>${axis.version}</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
<version>2.7.15</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-yaml</artifactId>
<version>2.14.2</version>
</dependency>

</dependencies>


</project>
2 changes: 1 addition & 1 deletion test/jest/acceptance/snyk-sbom/all-projects.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ describe('snyk sbom --all-projects (mocked server only)', () => {
expect(bom.metadata.component.name).toEqual(
'mono-repo-project-manifests-only',
);
expect(bom.components).toHaveLength(36);
expect(bom.components).toHaveLength(37);
});
});
8 changes: 4 additions & 4 deletions test/jest/acceptance/snyk-sbom/maven-options.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ describe('snyk sbom: maven options (mocked server only)', () => {
'io.snyk.example:test-project',
);
expect(sbom.dependencies.length).toBeGreaterThanOrEqual(7);
expect(sbom.dependencies[6].ref).toEqual(
expect(sbom.dependencies[2].ref).toEqual(
'commons-discovery:commons-discovery@0.2',
);
expect(sbom.dependencies[6].dependsOn.length).toEqual(1);
expect(sbom.dependencies[6].dependsOn[0]).toEqual(
'commons-logging:commons-logging@1.0.4',
Comment on lines -64 to -66
Copy link
Contributor

Choose a reason for hiding this comment

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

Just curious about this change, can you explain? Length of dependencies because you go depth first I presume? But why does the version change?

Copy link
Contributor Author

@gemaxim gemaxim May 14, 2025

Choose a reason for hiding this comment

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

package version in the key for the visited/ancestry. this means that we'll include all the versions that dverbose outputs. An example, with scope too is included is here in this output: https://github.com/snyk/snyk-mvn-plugin/pull/188/files#diff-2ce7e54ca0da5e7003be9ff7c3606b9a54fbcddf4b01c062b202b57786475b94.
That version is not actually resolved by maven, but maven Dverbose does mention it as omitted.
We are waiting on a product decision here for our Dverbose functionality, I personally think that only the version that maven resolves should be included.
But, in the meantime, to unblock, we are adding exactly what Dverbose outputs.

expect(sbom.dependencies[2].dependsOn.length).toEqual(1);
expect(sbom.dependencies[2].dependsOn[0]).toEqual(
'commons-logging:commons-logging@1.0.3',
);
});

Expand Down
13 changes: 13 additions & 0 deletions test/jest/acceptance/snyk-test/maven-dverbose.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,17 @@ describe('`snyk test` of basic projects for each language/ecosystem', () => {

expect(code).toEqual(0);
});

test('run `snyk test` on a maven project with Dverbose omitted versions', async () => {
const project = await createProjectFromWorkspace(
'maven-dverbose-omitted-versions',
);

const { code } = await runSnykCLI('test -d - --Dverbose', {
cwd: project.path(),
env,
});

expect(code).toEqual(0);
});
});