How to Create Maven Java Project on Ubuntu Command Line – Step-by-step

December 18, 2021 | By the+gnu+linux+evangelist.

Creating Project

  1. 2. Installing Maven

    Now to Install Maven for Ubuntu
    Simply play:

    sudo apt install maven
  2. 3. Making Java Project

    Maven 3 Command to Create a Simple Java Project
    The general form is:

    mvn archetype:generate
    -DgroupId=[yourPackagingId]
    -DartifactId=[yourProjectName]
    

    And so for Example:

    mvn archetype:generate
    -DgroupId=com.tutorialforlinux
    -DartifactId=myJavaPro
    

    This should then create a Maven Project Structure like:

    .
    |-- src
    |  |-- main
    |  |  `-- java
    |  |    `-- [your project's package]
    |  |      `-- App.java
    |  `-- test
    |    `-- java
    |      `-- [your project's package]
    |        `-- AppTest.java
    `-- pom.xml
    
  3. 4. Setting up Eclipse

    How to Integrate a Maven Java Project into Eclipse:

    Maven Eclipse Integration

    Getting-Started with Java Development on Eclipse IDE for Ubuntu: Installing Eclipse on Ubuntu

Contents


QuickChic Theme • Powered by WordPress