5

For years, I've used Spring Initializr (at https://start.spring.io/) to create the initial SpringBoot application and then modify it to create the app. This works fine.

Is there a maven archetype I can use to create a SpringBoot app? Or is the Spring Initializr the only way to do this.

Searching I found this:

Which shows the command:

mvn archetype:generate -Dfilter=org.apache.maven.archetypes:

Which gives me a list of 14 items to choose from. None of them mention SpringBoot. The closest match is org.apache.maven.archetypes:maven-archetype-webapp, so I tried it and it created a WebApp (*.war) which is not what I'm looking for.

PatS
  • 8,833
  • 12
  • 57
  • 100

2 Answers2

5

The aim of the Maven archetype is for generating a project skeleton. The Spring Initialiser also does the same but I think you should find it more user friendly to use when compared to executing a maven archetype command.

If you insist to use maven archetype , you can simply search Github to see if there are people share their archetypes (search result at here)

If your aim is just to use command to generate a spring-boot project skeleton , Spring Initializr actually provide an HTTP API to do it.

Also you can checkout JHipster, which is another tool to generate a spring-boot project skeleton.

Ken Chan
  • 84,777
  • 26
  • 143
  • 172
4

You could also use Spring Boot CLI to scaffold new Spring Boot projects:

spring init --dependencies=web,data-jpa my-new-project

It works just as Spring Initializr, but on the command line.

See section 2.4 "Initialize a New Project" on Spring Boot CLI documentation here: https://docs.spring.io/spring-boot/docs/current/reference/html/cli.html#cli.using-the-cli.initialize-new-project