Skip to content

Commit 76294e9

Browse files
authored
NLIC-2360: Update code style plugins (#27)
* Update code style plugins * Rename labs64-rulesets to labs64-code-analysis * Small logging fixes * Use site phase * Add site plugin * Use parameter for failOnViolation Co-authored-by: Alexey Averikhin <alexey.averikhin@labs64.de>
1 parent 58a42e4 commit 76294e9

4 files changed

Lines changed: 129 additions & 4 deletions

File tree

NetLicensingClient-demo/src/main/java/com/labs64/netlicensing/demo/NetLicensingClientDemo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ public static void main(final String[] args) {
3939
}
4040

4141
if (cmd.hasOption("l")) {
42+
System.out.println("Available examples:");
4243
AllExamples.list.forEach((key, val) -> {
43-
System.out.println("Available examples:");
4444
System.out.println(" " + key);
4545
});
4646
return;

NetLicensingClient-demo/src/main/resources/log4j2.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
<Configuration>
33

44
<Appenders>
5-
<Console name="nlic-console" target="SYSTEM_OUT">
5+
<Console name="demo-console" target="SYSTEM_OUT">
66
<PatternLayout pattern="%d [%p] %m%n"/>
77
</Console>
88
</Appenders>
99

1010
<Loggers>
1111
<Root level="info">
12-
<AppenderRef ref="nlic-console"/>
12+
<AppenderRef ref="demo-console"/>
1313
</Root>
1414
</Loggers>
1515

NetLicensingClient/pom.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,19 @@
141141
</execution>
142142
</executions>
143143
</plugin>
144+
145+
<plugin>
146+
<groupId>org.apache.maven.plugins</groupId>
147+
<artifactId>maven-checkstyle-plugin</artifactId>
148+
</plugin>
149+
<plugin>
150+
<groupId>com.github.spotbugs</groupId>
151+
<artifactId>spotbugs-maven-plugin</artifactId>
152+
</plugin>
153+
<plugin>
154+
<groupId>org.apache.maven.plugins</groupId>
155+
<artifactId>maven-pmd-plugin</artifactId>
156+
</plugin>
144157
</plugins>
145158
</build>
146159
</project>

pom.xml

Lines changed: 113 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@
9292
<maven-release-plugin.version>2.5.3</maven-release-plugin.version>
9393
<nexus-staging-maven-plugin.version>1.6.8</nexus-staging-maven-plugin.version>
9494
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
95-
<maven-javadoc-plugin.version>3.3.0</maven-javadoc-plugin.version>
95+
<maven-site-plugin.version>3.9.1</maven-site-plugin.version>
96+
<maven-javadoc-plugin.version>3.3.1</maven-javadoc-plugin.version>
9697
<maven-dependency-plugin.version>3.1.2</maven-dependency-plugin.version>
9798
<maven-gpg-plugin.version>1.6</maven-gpg-plugin.version>
9899
<!-- TODO(AY): change version when the new release comes. Java 11 Warning https://github.com/highsource/maven-jaxb2-plugin/issues/148 -->
@@ -103,6 +104,13 @@
103104
<maven-jar-plugin.version>3.2.0</maven-jar-plugin.version>
104105
<maven-shade-plugin.version>3.2.4</maven-shade-plugin.version>
105106
<maven-bundle-plugin.version>5.1.1</maven-bundle-plugin.version>
107+
<!-- Code Analysis -->
108+
<labs64.code-analysis.version>2.0.1</labs64.code-analysis.version>
109+
<labs64.code-analysis.phase>site</labs64.code-analysis.phase>
110+
<labs64.code-analysis.failOnViolation>false</labs64.code-analysis.failOnViolation>
111+
<maven-checkstyle-plugin.version>3.1.2</maven-checkstyle-plugin.version>
112+
<spotbugs-maven-plugin.version>4.5.3.0</spotbugs-maven-plugin.version>
113+
<maven-pmd-plugin.version>3.15.0</maven-pmd-plugin.version>
106114
</properties>
107115

108116
<build>
@@ -131,6 +139,15 @@
131139
</execution>
132140
</executions>
133141
</plugin>
142+
<plugin>
143+
<groupId>org.apache.maven.plugins</groupId>
144+
<artifactId>maven-site-plugin</artifactId>
145+
<version>${maven-site-plugin.version}</version>
146+
<configuration>
147+
<locales>en</locales>
148+
<outputEncoding>UTF-8</outputEncoding>
149+
</configuration>
150+
</plugin>
134151
<plugin>
135152
<groupId>org.apache.maven.plugins</groupId>
136153
<artifactId>maven-javadoc-plugin</artifactId>
@@ -270,6 +287,97 @@
270287
<artifactId>maven-bundle-plugin</artifactId>
271288
<version>${maven-bundle-plugin.version}</version>
272289
</plugin>
290+
291+
<!-- https://maven.apache.org/plugins/maven-checkstyle-plugin/usage.html -->
292+
<plugin>
293+
<groupId>org.apache.maven.plugins</groupId>
294+
<artifactId>maven-checkstyle-plugin</artifactId>
295+
<version>${maven-checkstyle-plugin.version}</version>
296+
<configuration>
297+
<configLocation>labs64-code-analysis/checkstyle.xml</configLocation>
298+
<failsOnError>${labs64.code-analysis.failOnViolation}</failsOnError>
299+
<propertyExpansion>basedir=${project.basedir}</propertyExpansion>
300+
<excludes>**/generated-sources/**/*</excludes>
301+
</configuration>
302+
<executions>
303+
<execution>
304+
<id>checkstyle</id>
305+
<phase>${labs64.code-analysis.phase}</phase>
306+
<goals>
307+
<goal>check</goal>
308+
</goals>
309+
</execution>
310+
</executions>
311+
<dependencies>
312+
<dependency>
313+
<groupId>com.labs64.commons</groupId>
314+
<artifactId>code-analysis</artifactId>
315+
<version>${labs64.code-analysis.version}</version>
316+
</dependency>
317+
</dependencies>
318+
</plugin>
319+
320+
<!-- https://spotbugs.github.io -->
321+
<plugin>
322+
<groupId>com.github.spotbugs</groupId>
323+
<artifactId>spotbugs-maven-plugin</artifactId>
324+
<version>${spotbugs-maven-plugin.version}</version>
325+
<configuration>
326+
<includeFilterFile>labs64-code-analysis/spotbugs.xml</includeFilterFile>
327+
<onlyAnalyze>com.labs64.-</onlyAnalyze>
328+
<failOnError>${labs64.code-analysis.failOnViolation}</failOnError>
329+
</configuration>
330+
<executions>
331+
<execution>
332+
<id>spotbugs</id>
333+
<phase>${labs64.code-analysis.phase}</phase>
334+
<goals>
335+
<goal>check</goal>
336+
</goals>
337+
</execution>
338+
</executions>
339+
<dependencies>
340+
<dependency>
341+
<groupId>com.labs64.commons</groupId>
342+
<artifactId>code-analysis</artifactId>
343+
<version>${labs64.code-analysis.version}</version>
344+
</dependency>
345+
</dependencies>
346+
</plugin>
347+
348+
<!-- https://maven.apache.org/plugins/maven-pmd-plugin/usage.html -->
349+
<plugin>
350+
<groupId>org.apache.maven.plugins</groupId>
351+
<artifactId>maven-pmd-plugin</artifactId>
352+
<version>${maven-pmd-plugin.version}</version>
353+
<configuration>
354+
<rulesets>
355+
<ruleset>labs64-code-analysis/pmd.xml</ruleset>
356+
</rulesets>
357+
<excludeRoots>
358+
<excludeRoot>target/generated-sources/xjc</excludeRoot>
359+
<excludeRoot>target/generated-sources/jaxws</excludeRoot>
360+
</excludeRoots>
361+
<failOnViolation>${labs64.code-analysis.failOnViolation}</failOnViolation>
362+
<printFailingErrors>true</printFailingErrors>
363+
</configuration>
364+
<executions>
365+
<execution>
366+
<id>pmd</id>
367+
<phase>${labs64.code-analysis.phase}</phase>
368+
<goals>
369+
<goal>check</goal>
370+
</goals>
371+
</execution>
372+
</executions>
373+
<dependencies>
374+
<dependency>
375+
<groupId>com.labs64.commons</groupId>
376+
<artifactId>code-analysis</artifactId>
377+
<version>${labs64.code-analysis.version}</version>
378+
</dependency>
379+
</dependencies>
380+
</plugin>
273381
</plugins>
274382
</pluginManagement>
275383

@@ -278,6 +386,10 @@
278386
<groupId>org.apache.maven.plugins</groupId>
279387
<artifactId>maven-enforcer-plugin</artifactId>
280388
</plugin>
389+
<plugin>
390+
<groupId>org.apache.maven.plugins</groupId>
391+
<artifactId>maven-site-plugin</artifactId>
392+
</plugin>
281393
</plugins>
282394
</build>
283395

0 commit comments

Comments
 (0)