-
-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Hervé Boutemy <hboutemy@apache.org>
- Loading branch information
Showing
6 changed files
with
106 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.cyclonedx.maven; | ||
|
||
import java.io.File; | ||
|
||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
import io.takari.maven.testing.executor.MavenRuntime.MavenRuntimeBuilder; | ||
import io.takari.maven.testing.executor.MavenVersions; | ||
import io.takari.maven.testing.executor.junit.MavenJUnitTestRunner; | ||
|
||
/** | ||
* test for https://github.com/CycloneDX/cyclonedx-maven-plugin/issues/280 | ||
* how to switch verbosity off by default, but let the user activate with CLI parameter | ||
*/ | ||
@RunWith(MavenJUnitTestRunner.class) | ||
@MavenVersions({"3.6.3"}) | ||
public class VerboseTest extends BaseMavenVerifier { | ||
|
||
public VerboseTest(MavenRuntimeBuilder runtimeBuilder) throws Exception { | ||
super(runtimeBuilder); | ||
} | ||
|
||
@Test | ||
public void testVerboseOffByDefault() throws Exception { | ||
File projDir = resources.getBasedir("verbose"); | ||
|
||
verifier | ||
.forProject(projDir) | ||
.withCliOption("-Dcurrent.version=" + getCurrentVersion()) // inject cyclonedx-maven-plugin version | ||
.withCliOption("-B") | ||
.execute("verify") | ||
.assertErrorFreeLog() | ||
.assertNoLogText("[INFO] CycloneDX: Parameters"); // check no verbose output by default given property defined in pom.xml | ||
} | ||
|
||
@Test | ||
public void testVerboseWithCli() throws Exception { | ||
File projDir = resources.getBasedir("verbose"); | ||
|
||
verifier | ||
.forProject(projDir) | ||
.withCliOption("-Dcurrent.version=" + getCurrentVersion()) // inject cyclonedx-maven-plugin version | ||
.withCliOption("-B") | ||
.withCliOption("-Dcyclonedx.verbose") // activate verbose with CLI parameter | ||
.execute("verify") | ||
.assertErrorFreeLog() | ||
.assertLogText("[INFO] CycloneDX: Parameters"); // check goal verbose output | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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>com.example</groupId> | ||
<artifactId>issue-280</artifactId> | ||
<packaging>jar</packaging> | ||
<version>1.0.0</version> | ||
|
||
<name>Issue-280: make verbose off by default, that can be overridden on CLI</name> | ||
|
||
<licenses> | ||
<license> | ||
<name>Apache-2.0</name> | ||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
</license> | ||
</licenses> | ||
|
||
<properties> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<cyclonedx.verbose>false</cyclonedx.verbose><!-- use the plugin-provided cyclonedx.verbose property to override default --> | ||
</properties> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.cyclonedx</groupId> | ||
<artifactId>cyclonedx-maven-plugin</artifactId> | ||
<version>${current.version}</version> | ||
<executions> | ||
<execution> | ||
<phase>verify</phase> | ||
<goals> | ||
<goal>makeBom</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
<configuration> | ||
<outputFormat>json</outputFormat> | ||
<!-- <verbose>false</verbose> do not inject a fixed value in the plugin configuration: it could not be overridden with CLI --> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |