HowToDoInJava

  • Python
  • Java
  • Spring Boot
  • Dark Mode
Home / Maven / Maven Create Java Project – Interactive vs Non-interactive modes

Maven Create Java Project – Interactive vs Non-interactive modes

Learn to create Java application project with maven commands, using interactive and non-interactive modes from command prompt.

Table of Contents

1. Maven non-interactive mode
2. Maven interactive mode

1. Maven create Java project with maven non-interactive mode

In non-interactive mode, maven creates a blank java project with all default options. To create this, type below command.

$ mvn archetype:generate 
		-DgroupId=com.howtodoinjava 
		-DartifactId=DemoJavaProject
		-DarchetypeArtifactId=maven-archetype-quickstart 
		-DinteractiveMode=false

This command will create a blank java project named DemoJavaProject in workspace. You can choose and use your own application name.

In below image, you can see what all happens when you run above command.

maven-create-java-project-4223005

You can see in step 2, that Java project created has src folder created and a default pom.xml has also been created for you.

2. Maven create Java project with maven interactive mode

In interactive mode, You just need to start with “mvn archetype:generate” and rest of the options will be specified using a wizard which will come one by one.

$ mvn archetype:generate

Lets see what steps comes in wizard:

2.1. mvn archetype:generate

This is default mode. When you type above command, it start the project creation and will stop at where it will ask for archetypeArtifactId. Wizard will present you a list of number to choose from or filter among them (because options list is very long).

arche_type_generate-8257782

2.2. Filtering

It can be done by typing some part of arctetype name e.g. quickstart.

filtering_maven-7183266

You need to choose option 18 for our simple java project.

2.3. Specify achetype version

Do it as 5 (or your own), and groupId as “com.howtodoinjava”.

maven_group_id-2551424

2.4. Define artifactId

Do it by desired java project name. Now, there will be some other options and confirmations. Answer them and your project is ready.

maven_options-8813301

You can see that you project is created with default source folder and pom.xml file.

This way, if you try your hands a couple of times, you will start liking this approach moreto create

Happy Learning !!

Was this post helpful?

Let us know if you liked the post. That’s the only way we can improve.
TwitterFacebookLinkedInRedditPocket

About Lokesh Gupta

A family guy with fun loving nature. Love computers, programming and solving everyday problems. Find me on Facebook and Twitter.

Feedback, Discussion and Comments

  1. praveen

    November 8, 2016

    Hi ,

    I am getting below exception and i am not able to resolve πŸ™

    [ERROR] No plugin found for prefix ‘archetype’ in the current project and in the
    plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the
    repositories [local (C:Userspraveena.m2repository), central (http://ipagbld0
    5.snt.bst.bls.com:5125/nexus/content/groups/public)] -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
    ch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please rea
    d the following articles:
    [ERROR] [Help 1] https://cwiki.apache.org//confluence/display/MAVEN/NoPluginFoundF
    orPrefixException

  2. Rajendra Joshi

    January 2, 2013

    demojavaApp is created, but when I select file-import-General-Existing projects-select root dir- demojavaApp
    No Projects are found to import , so what to do?
    should I create jar file then import jar file , does that jar file gets extracted in to project by eclipse?

    • Lokesh Gupta

      January 2, 2013

      Rajendra, to add support for eclipse IDE You must run following command.

      mvn eclipse:eclipse

      Above command will create .project file which is needed by eclipse.

Comments are closed on this article!

Search Tutorials

Maven Tutorial

  • Maven – Installation
  • Maven – Settings
  • Maven – Dependency Mgmt
  • Maven – Dependency Scopes
  • Maven – POM
  • Maven – Parent POM
  • Maven – Repositories
  • Maven – Local Repo Path
  • Maven – M2_REPO
  • Maven – Network Proxy
  • Maven – Enforce Java Versions
  • Maven – Simple Java Project
  • Maven – Web Project
  • Maven – Multi-module Project 1
  • Maven – Multi-module Project 2
  • Maven – Java Source Folders
  • Maven – BOM [Bill Of Materials]
  • Maven – Import Remote Catalogs
  • Maven – Create Custom Archetype
  • Maven – Compiler Level Mismatch
  • Maven – Ant Build
  • Maven – IntelliJ
  • Maven – JSTL Support
  • Maven – Tomcat Plugin
  • Maven – Uber Jar for Spring Boot
  • Maven – Shade Plugin
  • Maven – Remove corrupt jars

Meta Links

  • About Me
  • Contact Us
  • Privacy policy
  • Advertise
  • Guest and Sponsored Posts

Recommended Reading

  • 10 Life Lessons
  • Secure Hash Algorithms
  • How Web Servers work?
  • How Java I/O Works Internally?
  • Best Way to Learn Java
  • Java Best Practices Guide
  • Microservices Tutorial
  • REST API Tutorial
  • How to Start New Blog

Copyright © 2020 · HowToDoInjava.com · All Rights Reserved. | Sitemap

  • Sealed Classes and Interfaces