Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/m1ad3n/maven-kickstart
Maven config for java applications
https://github.com/m1ad3n/maven-kickstart
build build-tool java kickstart maven maven-plugin project test testing
Last synced: 2 days ago
JSON representation
Maven config for java applications
- Host: GitHub
- URL: https://github.com/m1ad3n/maven-kickstart
- Owner: m1ad3n
- Created: 2024-11-22T19:22:08.000Z (2 months ago)
- Default Branch: master
- Last Pushed: 2024-11-22T20:02:59.000Z (2 months ago)
- Last Synced: 2024-11-22T20:29:17.023Z (2 months ago)
- Topics: build, build-tool, java, kickstart, maven, maven-plugin, project, test, testing
- Language: Java
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
![build badge](https://github.com/m1ad3n/maven-kickstart/actions/workflows/maven.yml/badge.svg)
# Maven KickstartThis is a basic setup for a Java application using Maven. It includes the necessary configuration for:
- Running the application using the exec-maven-plugin
- Running tests with JUnit 5### Project Structure
This project follows a standard Maven directory structure:
```
.
├── pom.xml # Maven configuration file
└── src
├── main
│ └── java # Java source code
└── test
└── java # Test classes
```### Maven Configuration
The pom.xml contains configurations for the following:
##### exec-maven-plugin
To run the Java application, we use the exec:java plugin. You can execute the application directly from Maven using the following command:
```
mvn exec:java
```
Ensure that the main class is defined in the pom.xml like this:
```xmlorg.codehaus.mojo
exec-maven-plugin
3.5.0
com.example.Main
```
##### JUnit 5 Configuration
The project is set up to run tests with JUnit 5. The configuration in pom.xml ensures JUnit 5 is used for testing.
```xml
org.junit.jupiter
junit-jupiter
5.11.3
test
```
Additionally, configure the maven-surefire-plugin to use JUnit 5:
```xml
org.apache.maven.plugins
maven-surefire-plugin
3.5.2
src/test/resources/testng.xml
```
##### Running Tests
To run your tests with JUnit 5, simply execute:
```
mvn test
```
This will run all tests located in src/test/java### Conclusion
This setup provides a basic Maven configuration for a Java application with the ability to run the application and tests using Maven goals. You can extend it with more dependencies, plugins, or custom configurations as needed for your project.