This how you should be using maven to create a java project from the scratch.
If you have already installed maven on your comuter run the following command. This will open you the interactive mode.
mvn archetype:generate
This will take sometime to load a big list of varies project types can create using maven.
Choose archetype:
1: remote -> am.ik.archetype:elm-spring-boot-blank-archetype (Blank multi project for Spring Boot + Elm)
2: remote -> am.ik.archetype:graalvm-blank-archetype (Blank project for GraalVM)
...
2934: remote -> za.co.absa.hyperdrive:component-archetype_2.11 (-)
2935: remote -> za.co.absa.hyperdrive:component-archetype_2.12 (-)
Last line of the list will be
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): 1785:
If you simply enter here maven will create the project relevent to 1785 which is
1785: remote -> org.apache.maven.archetypes:maven-archetype-quickstart (An archetype which contains a sample Maven project.)
If you wanna create a different project you can select from the list, for example 2703 will be
2703: remote -> org.springframework.boot:spring-boot-sample-simple-archetype (Spring Boot Simple Sample)
If you select 1785 and enter you will be prompted to select the version
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): 1785:
Choose org.apache.maven.archetypes:maven-archetype-quickstart version:
1: 1.0-alpha-1
2: 1.0-alpha-2
3: 1.0-alpha-3
4: 1.0-alpha-4
5: 1.0
6: 1.1
7: 1.3
8: 1.4
Choose a number: 8:
You can continue with the default
Then for the next steps you can enter, can confirm by pressing ‘y’
Define value for property ‘groupId’: mygroupId
Define value for property ‘artifactId’: myartifactId
Define value for property ‘version’ 1.0-SNAPSHOT: :
Define value for property ‘package’ myartifactId: :
Confirm properties configuration:
groupId: test
artifactId: myartifactId
version: 1.0-SNAPSHOT
package: test
Y: : y
All done, you got a new project for your coding …
Quick Way
Interactive mode is bit time consuming, if you go the data you can create the in a single line as below
mvn archetype:generate
-DgroupId={project-packaging}
-DartifactId={project-name}
-DarchetypeArtifactId={maven-template}
-DinteractiveMode=false
Alternatives
Not a great maven fan! ok then this for you …
Have a look on my other posts …