Skip to content

Commit 3b14b4a

Browse files
ericbottardilayaperumalg
authored andcommitted
Fix various build issues
This commit addresses several build issues: - Makes sure the checkstyle validation runs AFTER the javaformat - Makes sure checkstyle runs only once (maven source jar generation shouldn't fork lifecylce in a reactor build) - Makes sure javaformat runs only once (remove nonsence in the BOM project) and correctly uses 0.0.47+ - Fixes checkstyle config that will be compatable with JSpecify annotation placement. - Clarities what the source/javadoc goals do (package, not generate new files) Signed-off-by: Eric Bottard <[email protected]>
1 parent 050b9f1 commit 3b14b4a

File tree

3 files changed

+69
-187
lines changed

3 files changed

+69
-187
lines changed

pom.xml

Lines changed: 68 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -369,11 +369,11 @@
369369
<spring-javaformat-maven-plugin.version>0.0.47</spring-javaformat-maven-plugin.version>
370370
<antora-maven-plugin.version>1.0.0-alpha.5</antora-maven-plugin.version>
371371
<antora-component-version-maven-plugin.version>0.0.4</antora-component-version-maven-plugin.version>
372-
<maven-checkstyle-plugin.version>3.5.0</maven-checkstyle-plugin.version>
372+
<maven-checkstyle-plugin.version>3.6.0</maven-checkstyle-plugin.version>
373373
<maven-checkstyle-plugin.failsOnError>true</maven-checkstyle-plugin.failsOnError>
374374
<maven-checkstyle-plugin.failOnViolation>true</maven-checkstyle-plugin.failOnViolation>
375375
<puppycrawl-tools-checkstyle.version>9.3</puppycrawl-tools-checkstyle.version>
376-
<spring-javaformat-checkstyle.version>0.0.43</spring-javaformat-checkstyle.version>
376+
<spring-javaformat-checkstyle.version>0.0.47</spring-javaformat-checkstyle.version>
377377
<maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
378378

379379
<error-prone.version>2.44.0</error-prone.version>
@@ -399,51 +399,6 @@
399399
</execution>
400400
</executions>
401401
</plugin>
402-
<plugin>
403-
<groupId>org.apache.maven.plugins</groupId>
404-
<artifactId>maven-checkstyle-plugin</artifactId>
405-
<version>${maven-checkstyle-plugin.version}</version>
406-
<dependencies>
407-
<dependency>
408-
<groupId>com.puppycrawl.tools</groupId>
409-
<artifactId>checkstyle</artifactId>
410-
<version>${puppycrawl-tools-checkstyle.version}</version>
411-
</dependency>
412-
<dependency>
413-
<groupId>io.spring.javaformat</groupId>
414-
<artifactId>spring-javaformat-checkstyle</artifactId>
415-
<version>${spring-javaformat-checkstyle.version}</version>
416-
</dependency>
417-
</dependencies>
418-
<executions>
419-
<execution>
420-
<id>checkstyle-validation</id>
421-
<phase>validate</phase>
422-
<inherited>true</inherited>
423-
<configuration>
424-
<skip>${disable.checks}</skip>
425-
<configLocation>src/checkstyle/checkstyle.xml</configLocation>
426-
<headerLocation>src/checkstyle/checkstyle-header.txt</headerLocation>
427-
<includeTestSourceDirectory>true</includeTestSourceDirectory>
428-
<propertyExpansion>
429-
checkstyle.build.directory=${project.build.directory}
430-
checkstyle.suppressions.file=${project.basedir}/src/checkstyle/checkstyle-suppressions.xml
431-
checkstyle.additional.suppressions.file=${project.basedir}/src/checkstyle/checkstyle-suppressions.xml
432-
checkstyle.header.file=${project.basedir}/src/checkstyle/checkstyle-header.txt
433-
</propertyExpansion>
434-
<consoleOutput>true</consoleOutput>
435-
<failsOnError>${maven-checkstyle-plugin.failsOnError}
436-
</failsOnError>
437-
<failOnViolation>
438-
${maven-checkstyle-plugin.failOnViolation}
439-
</failOnViolation>
440-
</configuration>
441-
<goals>
442-
<goal>check</goal>
443-
</goals>
444-
</execution>
445-
</executions>
446-
</plugin>
447402
<plugin>
448403
<groupId>org.apache.maven.plugins</groupId>
449404
<artifactId>maven-site-plugin</artifactId>
@@ -553,13 +508,10 @@
553508
<version>${maven-surefire-plugin.version}</version>
554509
<configuration>
555510
<argLine>${surefireArgLine}</argLine>
556-
557511
<useFile>false</useFile>
558512
<trimStackTrace>false</trimStackTrace>
559-
560513
<!-- Show test timing information -->
561514
<reportFormat>plain</reportFormat>
562-
563515
<!-- Output test execution times in the logs -->
564516
<redirectTestOutputToFile>false</redirectTestOutputToFile>
565517
</configuration>
@@ -583,10 +535,10 @@
583535
<version>${maven-source-plugin.version}</version>
584536
<executions>
585537
<execution>
586-
<id>generate-sources</id>
538+
<id>package-sources</id>
587539
<phase>package</phase>
588540
<goals>
589-
<goal>jar</goal>
541+
<goal>jar-no-fork</goal>
590542
</goals>
591543
</execution>
592544
</executions>
@@ -643,7 +595,7 @@
643595
</configuration>
644596
<executions>
645597
<execution>
646-
<id>generate-javadocs</id>
598+
<id>package-javadocs</id>
647599
<phase>package</phase>
648600
<goals>
649601
<goal>jar</goal>
@@ -672,6 +624,7 @@
672624
<version>${spring-javaformat-maven-plugin.version}</version>
673625
<executions>
674626
<execution>
627+
<id>format-check</id>
675628
<phase>validate</phase>
676629
<inherited>true</inherited>
677630
<goals>
@@ -700,6 +653,7 @@
700653
<version>${spring-javaformat-maven-plugin.version}</version>
701654
<executions>
702655
<execution>
656+
<id>format-apply</id>
703657
<phase>process-sources</phase>
704658
<inherited>true</inherited>
705659
<goals>
@@ -713,6 +667,67 @@
713667
</build>
714668

715669
</profile>
670+
<profile>
671+
<!-- Moving this plugin in an always active profile that appears *after* the
672+
conditional javaformat -->
673+
<id>checkstyle-check</id>
674+
<activation>
675+
<activeByDefault>true</activeByDefault>
676+
</activation>
677+
<build>
678+
<plugins>
679+
<plugin>
680+
<groupId>org.apache.maven.plugins</groupId>
681+
<artifactId>maven-checkstyle-plugin</artifactId>
682+
<version>${maven-checkstyle-plugin.version}</version>
683+
<dependencies>
684+
<dependency>
685+
<groupId>com.puppycrawl.tools</groupId>
686+
<artifactId>checkstyle</artifactId>
687+
<version>${puppycrawl-tools-checkstyle.version}</version>
688+
</dependency>
689+
<dependency>
690+
<groupId>io.spring.javaformat</groupId>
691+
<artifactId>spring-javaformat-checkstyle</artifactId>
692+
<version>${spring-javaformat-checkstyle.version}</version>
693+
</dependency>
694+
</dependencies>
695+
<executions>
696+
<execution>
697+
<id>checkstyle-validation</id>
698+
<phase>verify</phase>
699+
<inherited>true</inherited>
700+
<configuration>
701+
<skip>${disable.checks}</skip>
702+
<configLocation>src/checkstyle/checkstyle.xml
703+
</configLocation>
704+
<headerLocation>src/checkstyle/checkstyle-header.txt
705+
</headerLocation>
706+
<includeTestSourceDirectory>true
707+
</includeTestSourceDirectory>
708+
<propertyExpansion>
709+
checkstyle.build.directory=${project.build.directory}
710+
checkstyle.suppressions.file=${project.basedir}/src/checkstyle/checkstyle-suppressions.xml
711+
checkstyle.additional.suppressions.file=${project.basedir}/src/checkstyle/checkstyle-suppressions.xml
712+
checkstyle.header.file=${project.basedir}/src/checkstyle/checkstyle-header.txt
713+
</propertyExpansion>
714+
<consoleOutput>true</consoleOutput>
715+
<failsOnError>${maven-checkstyle-plugin.failsOnError}
716+
</failsOnError>
717+
<failOnViolation>
718+
${maven-checkstyle-plugin.failOnViolation}
719+
</failOnViolation>
720+
</configuration>
721+
<goals>
722+
<goal>check</goal>
723+
</goals>
724+
</execution>
725+
</executions>
726+
</plugin>
727+
728+
</plugins>
729+
</build>
730+
</profile>
716731
<profile>
717732
<id>license</id>
718733
<activation>

spring-ai-bom/pom.xml

Lines changed: 0 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,6 @@
7373

7474
<properties>
7575
<flatten-maven-plugin.version>1.5.0</flatten-maven-plugin.version>
76-
<spring-javaformat-maven-plugin.version>0.0.43</spring-javaformat-maven-plugin.version>
77-
<maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version>
78-
<maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
79-
<maven-surefire-plugin.version>3.1.2</maven-surefire-plugin.version>
80-
<maven-failsafe-plugin.version>3.5.2</maven-failsafe-plugin.version>
81-
<maven-javadoc-plugin.version>3.5.0</maven-javadoc-plugin.version>
82-
<maven-site-plugin.version>4.0.0-M13</maven-site-plugin.version>
83-
<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
8476
<maven-deploy-plugin.version>3.1.1</maven-deploy-plugin.version>
8577
</properties>
8678

@@ -1279,106 +1271,6 @@
12791271

12801272
<build>
12811273
<plugins>
1282-
<plugin>
1283-
<groupId>io.spring.javaformat</groupId>
1284-
<artifactId>spring-javaformat-maven-plugin</artifactId>
1285-
<version>${spring-javaformat-maven-plugin.version}</version>
1286-
<executions>
1287-
<execution>
1288-
<phase>validate</phase>
1289-
<inherited>true</inherited>
1290-
<goals>
1291-
<goal>validate</goal>
1292-
</goals>
1293-
</execution>
1294-
</executions>
1295-
</plugin>
1296-
<plugin>
1297-
<groupId>org.apache.maven.plugins</groupId>
1298-
<artifactId>maven-site-plugin</artifactId>
1299-
<version>${maven-site-plugin.version}</version>
1300-
</plugin>
1301-
<plugin>
1302-
<groupId>org.apache.maven.plugins</groupId>
1303-
<artifactId>maven-compiler-plugin</artifactId>
1304-
<version>${maven-compiler-plugin.version}</version>
1305-
<configuration>
1306-
<release>${java.version}</release>
1307-
<compilerArgs>
1308-
<compilerArg>-parameters</compilerArg>
1309-
</compilerArgs>
1310-
</configuration>
1311-
<executions>
1312-
<!-- Replacing default-compile as it is treated specially by Maven -->
1313-
<execution>
1314-
<id>default-compile</id>
1315-
<phase>none</phase>
1316-
</execution>
1317-
<!-- Replacing default-testCompile as it is treated specially by Maven -->
1318-
<execution>
1319-
<id>default-testCompile</id>
1320-
<phase>none</phase>
1321-
</execution>
1322-
<execution>
1323-
<id>java-compile</id>
1324-
<phase>compile</phase>
1325-
<goals>
1326-
<goal>compile</goal>
1327-
</goals>
1328-
</execution>
1329-
<execution>
1330-
<id>java-test-compile</id>
1331-
<phase>test-compile</phase>
1332-
<goals>
1333-
<goal>testCompile</goal>
1334-
</goals>
1335-
</execution>
1336-
</executions>
1337-
</plugin>
1338-
<plugin>
1339-
<groupId>org.apache.maven.plugins</groupId>
1340-
<artifactId>maven-surefire-plugin</artifactId>
1341-
<version>${maven-surefire-plugin.version}</version>
1342-
<configuration>
1343-
<argLine>${surefireArgLine}</argLine>
1344-
1345-
<useFile>false</useFile>
1346-
<trimStackTrace>false</trimStackTrace>
1347-
1348-
<!-- Show test timing information -->
1349-
<reportFormat>plain</reportFormat>
1350-
1351-
<!-- Output test execution times in the logs -->
1352-
<redirectTestOutputToFile>false</redirectTestOutputToFile>
1353-
</configuration>
1354-
</plugin>
1355-
<plugin>
1356-
<groupId>org.apache.maven.plugins</groupId>
1357-
<artifactId>maven-jar-plugin</artifactId>
1358-
<version>${maven-jar-plugin.version}</version>
1359-
<configuration>
1360-
<archive>
1361-
<manifestEntries>
1362-
<Implementation-Title>${project.artifactId}</Implementation-Title>
1363-
<Implementation-Version>${project.version}</Implementation-Version>
1364-
</manifestEntries>
1365-
</archive>
1366-
</configuration>
1367-
</plugin>
1368-
<plugin>
1369-
<groupId>org.apache.maven.plugins</groupId>
1370-
<artifactId>maven-source-plugin</artifactId>
1371-
<version>${maven-source-plugin.version}</version>
1372-
<executions>
1373-
<execution>
1374-
<id>generate-sources</id>
1375-
<phase>package</phase>
1376-
<goals>
1377-
<goal>jar</goal>
1378-
</goals>
1379-
</execution>
1380-
</executions>
1381-
</plugin>
13821274
<plugin>
13831275
<groupId>org.codehaus.mojo</groupId>
13841276
<artifactId>flatten-maven-plugin</artifactId>
@@ -1417,28 +1309,6 @@
14171309
<artifactId>maven-deploy-plugin</artifactId>
14181310
<version>${maven-deploy-plugin.version}</version>
14191311
</plugin>
1420-
<plugin>
1421-
<groupId>org.apache.maven.plugins</groupId>
1422-
<artifactId>maven-javadoc-plugin</artifactId>
1423-
<version>${maven-javadoc-plugin.version}</version>
1424-
<configuration>
1425-
<overview>
1426-
${project.basedir}/spring-ai-docs/src/main/javadoc/overview.html</overview>
1427-
<detectJavaApiLink>false</detectJavaApiLink>
1428-
<failOnError>false</failOnError>
1429-
<doclint>none</doclint>
1430-
</configuration>
1431-
<executions>
1432-
<execution>
1433-
<id>generate-javadocs</id>
1434-
<phase>package</phase>
1435-
<goals>
1436-
<goal>jar</goal>
1437-
</goals>
1438-
</execution>
1439-
</executions>
1440-
</plugin>
1441-
14421312
</plugins>
14431313
</build>
14441314

src/checkstyle/checkstyle.xml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@
4545
</module>
4646
<module name="com.puppycrawl.tools.checkstyle.checks.annotation.MissingOverrideCheck" />
4747
<module name="com.puppycrawl.tools.checkstyle.checks.annotation.PackageAnnotationCheck" />
48-
<module name="com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationLocationCheck">
49-
<property name="allowSamelineSingleParameterlessAnnotation"
50-
value="false" />
51-
</module>
48+
<module name="com.puppycrawl.tools.checkstyle.checks.annotation.AnnotationLocationCheck" />
5249

5350
<!-- Block Checks -->
5451
<module name="com.puppycrawl.tools.checkstyle.checks.blocks.EmptyBlockCheck">

0 commit comments

Comments
 (0)