I'm building a Spring Boot project with Gradle migrating it from Maven. I wonder what Gradle task is doing the same thing as the package
phase in Maven.
Thank you!
I'm building a Spring Boot project with Gradle migrating it from Maven. I wonder what Gradle task is doing the same thing as the package
phase in Maven.
Thank you!
Maven build is based on build cycle phases, Gradle build is based on tasks and tasks dependencies.
Maven package phase can execute multiple plugin goals that is configured up to the package phase in the lifecycle. The same thing can be achieve with gradle using tasks(and maybe creating task dependencies to integrate them in to default build)
If you only care about running unit tests and creating jar file; gradle way would be gradle build
. If other actions are also concern in the maven package phase, additional gradle tasks should be added.
See the diagram from the java plugin documentation here
As Matej Marconak said:
gradle build
gradle assemble
Maven build is based on build cycle phases, Gradle build is based on tasks and tasks dependencies.
Maven package phase can execute multiple plugin goals that is configured up to the package phase in the lifecycle. The same thing can be achieve with gradle using tasks(and maybe creating task dependencies to integrate them in to default build)
If you only care about running unit tests and creating jar file; gradle way would be gradle build
. If other actions are also concern in the maven package phase, additional gradle tasks should be added.
You can use gradle assemble
or gradle build
.
gradle assemble
only create .jar/.war, gradle build
run test. –
Squirt gradle build
–
Eleven © 2022 - 2024 — McMap. All rights reserved.