A simple Java Maven project that displays "Hello World" on the console.
- Java 17 or higher
- Maven 3.6 or higher
JavaTest/
├── README.md
├── pom.xml # Maven configuration
├── src/
│ ├── main/
│ │ └── java/
│ │ └── com/
│ │ └── example/
│ │ └── HelloWorld.java # Main application
│ └── test/
│ └── java/
│ └── com/
│ └── example/
│ └── HelloWorldTest.java # Unit tests
└── .gitignore # Git ignore file for Maven projects
# Compile the project
mvn compile
# Run tests
mvn test
# Run the application
mvn exec:java -Dexec.mainClass="com.example.HelloWorld"
# Build JAR file
mvn package
# Compile first
mvn compile
# Run with Java
java -cp target/classes com.example.HelloWorld
Hello World
mvn clean
- Clean build artifactsmvn compile
- Compile the source codemvn test
- Run unit testsmvn package
- Create JAR filemvn exec:java
- Run the main class