8

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!

Dmitry Senkovich
  • 5,521
  • 8
  • 37
  • 74

3 Answers3

10

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
lance-java
  • 25,497
  • 4
  • 59
  • 101
7

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.

miskender
  • 7,460
  • 1
  • 19
  • 23
3

You can use gradle assemble or gradle build.

Matej Marconak
  • 1,365
  • 3
  • 20
  • 25