Cannot set application properties via mvn release plugin - spring-boot

In CI part most of the times I prefer standard maven phases to execute build steps. In these cases I override application.properties e.g.: -Dlogging.level.root=OFF -Dspring.main.banner-mode=off to turn off debugging logs and save some precious build time.
In some pipelines I prefer to use maven release plugin and I noticed that these flags does not work there.
e.g.: mvn release:prepare -Dspring.main.banner-mode=off
[INFO]
[INFO] . ____ _ __ _ _
[INFO] /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
[INFO] ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
[INFO] \\/ ___)| |_)| | | | | || (_| | ) ) ) )
[INFO] ' |____| .__|_| |_|_| |_\__, | / / / /
[INFO] =========|_|==============|___/=/_/_/_/
[INFO] :: Spring Boot :: (v2.1.4.RELEASE)
[INFO]
Still display spring banner
Any suggestion?

Related

maven failsafe plugin is not reporting cucumber test execution statistics

I am using below library versions in my SpringBoot project and cucumber for integrations tests,
Java - 11.0.11
Maven - 3.8.1
SpringBoot - 2.3.12.RELEASE
Cucumber - 6.10.4
Junit5 Jupiter - 5.4.0
Failsafe plugin - 3.0.0-M5
Although cucumber feature tests are being picked up and executed, I am not seeing any execution report from fail-safe plugin,
[INFO] --- maven-failsafe-plugin:3.0.0-M5:integration-test (default) # my-project ---
[INFO] Failsafe report directory: /Users/ZZZ/my-project/target/failsafe-reports
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.12.RELEASE)
2021-07-08 INFO 77791 --- [ main] Started SpringContext in 4.018 seconds (JVM running for 6.525)
Scenario: some scenario # /some_scenario.feature:2
Given some precondition
When some action is taken
Then something should have happened
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
I am wondering what's missing in my setup which is leading to fail-safe plugin output like this,
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
More worrying thing is that even if any cucumber test fails, fail-safe is not reporting anything and maven build succeeds. This could easily lead to false positives.
fixed by reverting both surefire and failsafe plugin to 2.22.2

Under what conditions is app.setBannerMode(Banner.Mode.OFF); ignored?

I am calling app.setBannerMode(Banner.Mode.OFF); in my application but I still get a banner.
My code:
SpringApplication app = new SpringApplication(MyApp.class);
app.setBannerMode(Banner.Mode.OFF);
app.setAdditionalProfiles("foobar");
Output:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.0.8.RELEASE)
Expected output:
(nothing)
What could be causing this?!

Bash complains about syntax errors in here-document when using backticks

I'm running the following piece of bash code:
cat << END_TEXT
_ _
| | | |
__ _| |__ ___ __| |
/ _` | '_ \ / __/ _` |
| (_| | |_) | (_| (_| |
\__,_|_.__/ \___\__,_|
END_TEXT
and am getting an error:
bash: command substitution: line 1: syntax error near unexpected token `|'
bash: command substitution: line 1: ` | '_ \ / __/ _'
No need to escape backticks. Just use quoted here-doc string as:
cat <<-'END_TEXT'
_ _
| | | |
__ _| |__ ___ __| |
/ _` | '_ \ / __/ _` |
| (_| | |_) | (_| (_| |
\__,_|_.__/ \___\__,_|
END_TEXT
As per man bash:
If word is unquoted, all lines of the here-document are subjected to parameter expansion, command substitution, and arithmetic expansion, the character sequence \<newline> is ignored, and \ must be used to quote the characters \, $, and `.
It's the backticks. Most content in a here-document is not intrepreted and used as-is, but backticks change this.
The solution: Escape them, even though it messes up the layout of your script:
cat << END_TEXT
_ _
| | | |
__ _| |__ ___ __| |
/ _\` | '_ \ / __/ _\` |
| (_| | |_) | (_| (_| |
\__,_|_.__/ \___\__,_|
END_TEXT

How can I change serenity-bdd log settings in maven

Were using serenity-bdd, and log analysis is important. But there is a lot of spam in the logging:
Serenety uses a lot of asci art in there logging witch is in my case waste of space and giving a lot of noice:
end2endtests | _____ _____ ____ _____ ____ _____ _ ____ _____ _____ ____
end2endtests | |_ _| ____/ ___|_ _| / ___|_ _|/ \ | _ \_ _| ____| _ \
end2endtests | | | | _| \___ \ | | \___ \ | | / _ \ | |_) || | | _| | | | |
end2endtests | | | | |___ ___) || | ___) || |/ ___ \| _ < | | | |___| |_| |
end2endtests | |_| |_____|____/ |_| |____/ |_/_/ \_\_| \_\|_| |_____|____/
end2endtests |
end2endtests |
And then on the end we get:
end2endtests | __ _____ _____ ____ _____ ____ _ ____ ____ _____ ____
end2endtests | _ \ \ |_ _| ____/ ___|_ _| | _ \ / \ / ___|/ ___|| ____| _ \
end2endtests | (_)_____| | | | | _| \___ \ | | | |_) / _ \ \___ \\___ \| _| | | | |
end2endtests | _|_____| | | | | |___ ___) || | | __/ ___ \ ___) |___) | |___| |_| |
end2endtests | (_) | | |_| |_____|____/ |_| |_| /_/ \_\____/|____/|_____|____/
end2endtests | /_/
end2endtests |
end2endtests | TEST PASSED
We do this in our Jenkins server trough a Maven command, I realy would like to reduce this noice so we have a bit less logging and sutch. I been googeling for it but havent found a clear cut answer that gave me the insight.
You need to pass -Dserenity.console.headings=minimal or -Dserenity.console.headings=normal in command line.
Or use
System.SetProperty("serenity.console.headings", "normal");
See below for more details
http://thucydides.info/docs/serenity-staging/
You can use below properties in serenity.properties file to turn off logging in reporting. (Serenity model/core version: 2.2.5)
serenity.console.headings=none to turn off the TEST STARTED banner and serenity.console.banner=none to turn off the SERENITY BDD banner.
Reference:
https://www.javadoc.io/doc/net.serenity-bdd/serenity-model/latest/net/thucydides/core/ThucydidesSystemProperty.html

spring boot server stops after main method execution

. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.3.3.RELEASE)
(application stops after main class execution.)

Resources