I am trying to create a Spring Boot project using its CLI with the command spring init --dependencies=web TestProject. With this TestProject project created. And the main class DemoApplication.java created with the package name com.example.
I want to create a spring-boot project with custom packageName and main className.
Taking a look at the
initcommand helps it. When you typespring help init, below is what you getThus to achieve what you want, you just need to specify the Group ID using the below command
The above command create a project in which the
DemoApplication.javais found with package namepackage com.mydomain.TestProject;and the pom has the group ID as<groupId>com.mydomain</groupId>If your requirement is not to change the artifact's Group ID but just change the package name, then you can use the command with the
--package-nameflagthis will create the class
DemoApplicationunder the packagecom.mydomainand retain the Group ID tocom.examplein the POM. Combine multiple flags if you need.