Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Awesome Lists containing this project

README

        

![build badge](https://github.com/m1ad3n/maven-kickstart/actions/workflows/maven.yml/badge.svg)
# Maven Kickstart

This 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:
```xml

org.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.