# Creating a Simple Java Project Using Maven in Terminal In this tutorial, we will walk through the process of creating a simple Java project using Maven from the terminal. ## Prerequisites - Java Development Kit (JDK) installed on your system - Maven installed on your system ## Steps ### 1. Open Terminal Open your terminal or command prompt. ### 2. Create a Project Directory Navigate to the directory where you want to create your Java project using the `cd` command: ```shell cd /path/to/your/project/directory ``` ### 3. Create the Maven Project Run the following Maven command to generate a basic Java project using the default archetype: ```shell mvn archetype:generate \-DgroupId=com.example \-DartifactId=my-java-project \-DarchetypeArtifactId=maven-archetype-quickstart \-DinteractiveMode=false ``` Replace `com.example` with your desired Group ID and `my-java-project` with your desired Artifact ID. ### 4. Navigate to the Project Directory Navigate into the newly created project directory: ```shell cd my-java-project ``` ### 5. Configure Maven Properties Open the `pom.xml` file in your project directory and add the following properties inside the `` section: > Note that you should change the `maven.compiler.source` and `maven.compiler.target` properties to suit the JDK version that you're running. ```xml 1.8 1.8 UTF-8 ``` These properties set the Java source and target versions to 1.8 and configure the source file encoding to UTF-8. ### 6. Build the Project Use Maven to clean and build your project: ```shell mvn clean install ``` This command will compile your project, run tests, and package it into a JAR file. ### 7. Review the Output You should see output indicating that the build was successful and that tests were executed. ### 8. Explore the Project Inside your project directory, you'll find the source code under `src/main/java`, with a simple Java class named `App.java`. ### 9. Customize Your Project You can modify the source code in `App.java` and add more Java classes as needed. ## Conclusion You have successfully created a simple Java project using Maven from the terminal. By configuring Maven properties, you ensure compatibility and smooth build processes for your project. You can now continue developing your project, adding dependencies, and expanding its functionality.