Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔀 Merge origin/100-setup-delombok-plugin into origin/dev #104

Merged
merged 1 commit into from
Aug 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ replay_pid*
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
.idea/
*.iws
*.iml
*.ipr
Expand Down
53 changes: 47 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<maven.central-publishing.version>0.5.0</maven.central-publishing.version>
<maven.checkerframework.version>3.46.0</maven.checkerframework.version>
<maven.checkstyle.version>3.4.0</maven.checkstyle.version>
<maven.delombok.version>1.18.20.0</maven.delombok.version>
<maven.compiler.version>3.13.0</maven.compiler.version>
<maven.assembly.version>3.7.1</maven.assembly.version>
<maven.mockito.version>5.12.0</maven.mockito.version>
Expand Down Expand Up @@ -106,13 +107,59 @@
</dependencies>

<build>
<sourceDirectory>target/generated-sources/delombok</sourceDirectory>
<testSourceDirectory>target/generated-test-sources/delombok</testSourceDirectory>

<plugins>

<!-- Default checkstyle configuration is fine -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven.checkstyle.version}</version>
<configuration>
<sourceDirectories>
<sourceDirectory>src/main/java</sourceDirectory>
<sourceDirectory>src/test/java</sourceDirectory>
</sourceDirectories>
</configuration>
</plugin>

<plugin>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-maven-plugin</artifactId>
<version>${maven.delombok.version}</version>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${maven.lombok.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>delombok</id>
<phase>generate-sources</phase>
<goals>
<goal>delombok</goal>
</goals>
<configuration>
<addOutputDirectory>false</addOutputDirectory>
<sourceDirectory>src/main/java</sourceDirectory>
</configuration>
</execution>
<execution>
<id>test-delombok</id>
<phase>generate-test-sources</phase>
<goals>
<goal>testDelombok</goal>
</goals>
<configuration>
<addOutputDirectory>false</addOutputDirectory>
<sourceDirectory>src/test/java</sourceDirectory>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
Expand Down Expand Up @@ -223,12 +270,6 @@
<artifactId>checker</artifactId>
<version>${maven.checkerframework.version}</version>
</path>

<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${maven.lombok.version}</version>
</path>
</annotationProcessorPaths>
<annotationProcessors>
<!-- Add all the checkers you want to enable here -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,31 @@
import org.junit.jupiter.api.Test;
import org.junit.platform.commons.util.ReflectionUtils;

/**
* Example test suite for {@link Example}.
*/
public class ExampleTest {
/**
* Exampel test for {@link Example#Example()}.
*/
@Test
public void shouldThrowUnsupportedOperationExceptionWhenInstantiatingExample() {
public void shouldThrowUnsupportedOperationExceptionWhenInstantiateExample() {
Assertions.assertThrows(UnsupportedOperationException.class, () -> {
ReflectionUtils.newInstance(Example.class);
});
}

/**
* Exampel test for {@link Example#example()}.
*/
@Test
public void shouldGetHelloWorldFromExampleFunction() {
Assertions.assertEquals("Hello, World!", Example.example());
}

/**
* Exampel test for {@link Example#main(String[])}.
*/
@Test
public void shouldExecuteMainFunctionWithoutErrors() {
Example.main(new String[] {});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/**
* Example package for project template.
*/
package io.github.lengors.maven_java_template;