Skip to content

Commit adf8d18

Browse files
appiepollo14gsmet
authored andcommitted
* OutputFormat param fixed
* OutputFile param fixed Fixes #47934 (cherry picked from commit 2479563)
1 parent b66960e commit adf8d18

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

devtools/maven/src/main/java/io/quarkus/maven/DependencySbomMojo.java

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,19 @@ public void execute() throws MojoExecutionException, MojoFailureException {
9696
getLog().info("Skipping config dump");
9797
return;
9898
}
99-
final Path outputFile = getSbomFile().toPath();
99+
final Path outputFilePath = getSbomFile().toPath();
100100
CycloneDxSbomGenerator.newInstance()
101101
.setManifest(ApplicationManifest.fromConfig(
102102
ApplicationManifestConfig.builder()
103103
.setApplicationModel(resolveApplicationModel())
104104
.build()))
105-
.setOutputFile(outputFile)
105+
.setOutputFile(outputFilePath)
106+
.setFormat(format)
106107
.setEffectiveModelResolver(EffectiveModelResolver.of(getResolver()))
107108
.setSchemaVersion(schemaVersion)
108109
.setIncludeLicenseText(includeLicenseText)
109110
.generate();
110-
getLog().info("The SBOM has been saved in " + outputFile);
111+
getLog().info("The SBOM has been saved in " + outputFilePath);
111112
}
112113

113114
private ApplicationModel resolveApplicationModel()
@@ -158,17 +159,18 @@ private File getSbomFile() {
158159
}
159160

160161
protected MavenArtifactResolver getResolver() {
161-
return resolver == null
162-
? resolver = workspaceProvider.createArtifactResolver(BootstrapMavenContext.config()
163-
.setUserSettings(session.getRequest().getUserSettingsFile())
164-
// The system needs to be initialized with the bootstrap model builder to properly interpolate system properties set on the command line
165-
// e.g. -Dquarkus.platform.version=xxx
166-
//.setRepositorySystem(repoSystem)
167-
// The session should be initialized with the loaded workspace
168-
//.setRepositorySystemSession(repoSession)
169-
.setRemoteRepositories(repos)
170-
// To support multi-module projects that haven't been installed
171-
.setPreferPomsFromWorkspace(true))
172-
: resolver;
162+
if (resolver == null) {
163+
resolver = workspaceProvider.createArtifactResolver(BootstrapMavenContext.config()
164+
.setUserSettings(session.getRequest().getUserSettingsFile())
165+
// The system needs to be initialized with the bootstrap model builder to properly interpolate system properties set on the command line
166+
// e.g. -Dquarkus.platform.version=xxx
167+
//.setRepositorySystem(repoSystem)
168+
// The session should be initialized with the loaded workspace
169+
//.setRepositorySystemSession(repoSession)
170+
.setRemoteRepositories(repos)
171+
// To support multi-module projects that haven't been installed
172+
.setPreferPomsFromWorkspace(true));
173+
}
174+
return resolver;
173175
}
174176
}

0 commit comments

Comments
 (0)