Spring-boot app logs to file in command line gradle - gradle

I was trying to log spring boot app logs to a file in Gradle.
Below is working for maven:
mvn spring-boot:run -Dspring-boot.run.profiles=it --log-file log.txt
This is my gradle startup command:
gradle.bat bootRun --args='--spring.profiles.active=it'

Related

Vaadin 14 Spring Boot App run from command line in ProductionMode

I want to run the spring boot application from a jar with embedded tomat, like I run other spring-boot apps.
The project is running fine, when started from IDE.
I want to run it from jar, but i get this error in the browser:
Failed to find the bundle manifest file 'frontend://vaadin-flow-bundle-manifest.json' in the servlet context for 'ES6' browsers.
I have set the productionMode to true in both application.properties and pom.xml. Why it is such a hustle? I don't know how to produce this json file. How to just run this project even in dev mode?
I start the project with:
mvn clean && mvn package -Pproduction && mvn spring-boot:run -Pproduction

Spring boot build without starting up the application

I want to build the spring boot jar file using maven like
mvn -B clean install -Pdev -DskipTests
But I do not want to start the spring boot app while doing this process as it cannot connect to the database from this build machine. How can I do that? Now the build is failing as it is trying to start up the server during the build process

what is the maven command to run springboot app on a desired port

I am trying to run my springboot application using maven command on windows command prompt.
I am trying to run the app on port 8000.
I tried the below command, but app always attempts to start at 8080 which is already occupied so start fails.
mvn -Dserver.port=8000 spring-boot:run
When I tried running the app through my IDE ( after placing server.port=8000 in application.properties file), it runs on 8000 as expected.
why does it not start on '8000' when ran through mvn command? Is there something wrong with the command?
If you use Spring Boot 2.x
mvn spring-boot:run -Dspring-boot.run.arguments=--server.port=8000
for Spring Boot 1.x
mvn spring-boot:run -Drun.arguments=--server.port=8000

unable to pass spring profile from gradle command line

I have gone through multiple suggestions in stackoverflow but unable to do it.
I have spring boot gradle app and trying to execute and run the gradle build through command line. I want to pass teh spring profile also while executing so.
I tried adding
bootRun {
systemProperties = System.properties
}
in gradle.build
and also tried
gradle bootrun -Pdev
command but it is not pciking up profile. I am very very new to gradle and dont sure what to do .
so i added below part in build.gradle
bootRun {
systemProperties = System.properties
}
and i used below command line command to pass spring profile.
gradle bootRun -Dspring.profiles.active=dev
i am able to see the below spring profile loaded logs.
The following profiles are active: dev

Task 'bootRepackage' not found in root project 'gateway'

I am reading Full Stack Development with JHipster book.
I created a Microservice gateway with 'gateway' app name.
By following the book when I run
./gradlew bootRepackage -Pprod buildDocker
in the terminal, it says
Task 'bootRepackage' not found in root project 'gateway'
and then stop running.
My Jhipster version is 5.0.0
In JHipster v5.0.0+, the goal bootRepackage doesn't exist. It has changed to bootWar, so you need to use:
./gradlew bootWar -Pprod buildDocker
I have similar issue for Spring Boot 2.X. And solved it by changing to bootJar.
gradlew clean && gradlew bootJar

Resources