Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Maven package phase equivalent in Gradle

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!

like image 355
Dmitry Senkovich Avatar asked Mar 19 '18 20:03

Dmitry Senkovich


3 Answers

See the diagram from the java plugin documentation here

java plugin tasks

As Matej Marconak said:

  • If you want to run tests you'd run gradle build
  • If you just want to build the jar you'd run gradle assemble
like image 76
lance-java Avatar answered Sep 21 '22 15:09

lance-java


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.

like image 36
miskender Avatar answered Sep 22 '22 15:09

miskender


You can use gradle assemble or gradle build.

like image 45
Matej Marconak Avatar answered Sep 18 '22 15:09

Matej Marconak