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

simplify life for using spotless (active per default), document property to de activate it #473

Merged
merged 1 commit into from
Feb 16, 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
35 changes: 23 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -698,6 +698,19 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<executions>
<execution>
<id>spotless-check</id>
<goals>
<goal>check</goal>
</goals>
<phase>validate</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
Expand Down Expand Up @@ -734,26 +747,24 @@
</build>

<profiles>
<profile>
<id>jdk8</id>
<activation>
<jdk>[1.8,]</jdk>
</activation>
<properties>
<!-- last version working with java 8 -->
<spotless-maven-plugin.version>2.30.0</spotless-maven-plugin.version>
slawekjaranowski marked this conversation as resolved.
Show resolved Hide resolved
</properties>
</profile>
<profile>
<id>java11+</id>
<activation>
<jdk>[11,)</jdk>
</activation>

<properties>
<maven.compiler.release>${mojo.java.target}</maven.compiler.release>
</properties>

<build>
<plugins>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<!-- only in parent, other projects must enable it by itself -->
<inherited>false</inherited>
</plugin>
</plugins>
</build>
</profile>

<profile>
Expand Down
24 changes: 2 additions & 22 deletions src/site/markdown/index.md.vm
Original file line number Diff line number Diff line change
Expand Up @@ -43,35 +43,15 @@ with options:
- other imports
- static import

In order to use `spotless` in your project, you should add to your pom.xml

Newer version of spotless requires JDK 11, so it must be add in profile unless your project requires 11 by default.
`spotless` will be activated in your project per default, if you don't want to use it

```xml
<properties>
<recommendedJavaBuildVersion>11</recommendedJavaBuildVersion>
<spotless.check.skip>true</spotless.check.skip>
</properties>

<profiles>
<profile>
<id>java11+</id>
<activation>
<jdk>[11,)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>
</profiles>
```

When `spotless` will be enabled, each build will be check according to correct code format.

To fix code, simply run:
```
mvn spotless:apply
Expand Down