Skip to content

Commit b75af37

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 <eric.bottard@broadcom.com>
1 parent ad11820 commit b75af37

File tree

4 files changed

+73
-191
lines changed

4 files changed

+73
-191
lines changed

models/spring-ai-vertex-ai-gemini/src/main/java/org/springframework/ai/vertexai/gemini/VertexAiGeminiChatModel.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,10 +401,10 @@ private ChatResponse internalCall(Prompt prompt, ChatResponse previousChatRespon
401401
.flatMap(List::stream)
402402
.toList();
403403

404-
GenerateContentResponse.UsageMetadata usage = generateContentResponse.getUsageMetadata();
405-
Usage currentUsage = new DefaultUsage(usage.getPromptTokenCount(), usage.getCandidatesTokenCount());
406-
Usage cumulativeUsage = UsageCalculator.getCumulativeUsage(currentUsage, previousChatResponse);
407-
ChatResponse chatResponse = new ChatResponse(generations, toChatResponseMetadata(cumulativeUsage));
404+
GenerateContentResponse.UsageMetadata usage = generateContentResponse.getUsageMetadata();
405+
Usage currentUsage = new DefaultUsage(usage.getPromptTokenCount(), usage.getCandidatesTokenCount());
406+
Usage cumulativeUsage = UsageCalculator.getCumulativeUsage(currentUsage, previousChatResponse);
407+
ChatResponse chatResponse = new ChatResponse(generations, toChatResponseMetadata(cumulativeUsage));
408408

409409
observationContext.setResponse(chatResponse);
410410
return chatResponse;

pom.xml

Lines changed: 68 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,11 @@
361361
<spring-javaformat-maven-plugin.version>0.0.43</spring-javaformat-maven-plugin.version>
362362
<antora-maven-plugin.version>1.0.0-alpha.5</antora-maven-plugin.version>
363363
<antora-component-version-maven-plugin.version>0.0.4</antora-component-version-maven-plugin.version>
364-
<maven-checkstyle-plugin.version>3.5.0</maven-checkstyle-plugin.version>
364+
<maven-checkstyle-plugin.version>3.6.0</maven-checkstyle-plugin.version>
365365
<maven-checkstyle-plugin.failsOnError>true</maven-checkstyle-plugin.failsOnError>
366366
<maven-checkstyle-plugin.failOnViolation>true</maven-checkstyle-plugin.failOnViolation>
367367
<puppycrawl-tools-checkstyle.version>9.3</puppycrawl-tools-checkstyle.version>
368-
<spring-javaformat-checkstyle.version>0.0.43</spring-javaformat-checkstyle.version>
368+
<spring-javaformat-checkstyle.version>0.0.47</spring-javaformat-checkstyle.version>
369369
<maven-gpg-plugin.version>3.2.8</maven-gpg-plugin.version>
370370

371371
<disable.checks>false</disable.checks>
@@ -374,51 +374,6 @@
374374

375375
<build>
376376
<plugins>
377-
<plugin>
378-
<groupId>org.apache.maven.plugins</groupId>
379-
<artifactId>maven-checkstyle-plugin</artifactId>
380-
<version>${maven-checkstyle-plugin.version}</version>
381-
<dependencies>
382-
<dependency>
383-
<groupId>com.puppycrawl.tools</groupId>
384-
<artifactId>checkstyle</artifactId>
385-
<version>${puppycrawl-tools-checkstyle.version}</version>
386-
</dependency>
387-
<dependency>
388-
<groupId>io.spring.javaformat</groupId>
389-
<artifactId>spring-javaformat-checkstyle</artifactId>
390-
<version>${spring-javaformat-checkstyle.version}</version>
391-
</dependency>
392-
</dependencies>
393-
<executions>
394-
<execution>
395-
<id>checkstyle-validation</id>
396-
<phase>validate</phase>
397-
<inherited>true</inherited>
398-
<configuration>
399-
<skip>${disable.checks}</skip>
400-
<configLocation>src/checkstyle/checkstyle.xml</configLocation>
401-
<headerLocation>src/checkstyle/checkstyle-header.txt</headerLocation>
402-
<includeTestSourceDirectory>true</includeTestSourceDirectory>
403-
<propertyExpansion>
404-
checkstyle.build.directory=${project.build.directory}
405-
checkstyle.suppressions.file=${project.basedir}/src/checkstyle/checkstyle-suppressions.xml
406-
checkstyle.additional.suppressions.file=${project.basedir}/src/checkstyle/checkstyle-suppressions.xml
407-
checkstyle.header.file=${project.basedir}/src/checkstyle/checkstyle-header.txt
408-
</propertyExpansion>
409-
<consoleOutput>true</consoleOutput>
410-
<failsOnError>${maven-checkstyle-plugin.failsOnError}
411-
</failsOnError>
412-
<failOnViolation>
413-
${maven-checkstyle-plugin.failOnViolation}
414-
</failOnViolation>
415-
</configuration>
416-
<goals>
417-
<goal>check</goal>
418-
</goals>
419-
</execution>
420-
</executions>
421-
</plugin>
422377
<plugin>
423378
<groupId>org.apache.maven.plugins</groupId>
424379
<artifactId>maven-site-plugin</artifactId>
@@ -504,13 +459,10 @@
504459
<version>${maven-surefire-plugin.version}</version>
505460
<configuration>
506461
<argLine>${surefireArgLine}</argLine>
507-
508462
<useFile>false</useFile>
509463
<trimStackTrace>false</trimStackTrace>
510-
511464
<!-- Show test timing information -->
512465
<reportFormat>plain</reportFormat>
513-
514466
<!-- Output test execution times in the logs -->
515467
<redirectTestOutputToFile>false</redirectTestOutputToFile>
516468
</configuration>
@@ -534,10 +486,10 @@
534486
<version>${maven-source-plugin.version}</version>
535487
<executions>
536488
<execution>
537-
<id>generate-sources</id>
489+
<id>package-sources</id>
538490
<phase>package</phase>
539491
<goals>
540-
<goal>jar</goal>
492+
<goal>jar-no-fork</goal>
541493
</goals>
542494
</execution>
543495
</executions>
@@ -594,7 +546,7 @@
594546
</configuration>
595547
<executions>
596548
<execution>
597-
<id>generate-javadocs</id>
549+
<id>package-javadocs</id>
598550
<phase>package</phase>
599551
<goals>
600552
<goal>jar</goal>
@@ -623,6 +575,7 @@
623575
<version>${spring-javaformat-maven-plugin.version}</version>
624576
<executions>
625577
<execution>
578+
<id>format-check</id>
626579
<phase>validate</phase>
627580
<inherited>true</inherited>
628581
<goals>
@@ -651,6 +604,7 @@
651604
<version>${spring-javaformat-maven-plugin.version}</version>
652605
<executions>
653606
<execution>
607+
<id>format-apply</id>
654608
<phase>process-sources</phase>
655609
<inherited>true</inherited>
656610
<goals>
@@ -664,6 +618,67 @@
664618
</build>
665619

666620
</profile>
621+
<profile>
622+
<!-- Moving this plugin in an always active profile that appears *after* the
623+
conditional javaformat -->
624+
<id>checkstyle-check</id>
625+
<activation>
626+
<activeByDefault>true</activeByDefault>
627+
</activation>
628+
<build>
629+
<plugins>
630+
<plugin>
631+
<groupId>org.apache.maven.plugins</groupId>
632+
<artifactId>maven-checkstyle-plugin</artifactId>
633+
<version>${maven-checkstyle-plugin.version}</version>
634+
<dependencies>
635+
<dependency>
636+
<groupId>com.puppycrawl.tools</groupId>
637+
<artifactId>checkstyle</artifactId>
638+
<version>${puppycrawl-tools-checkstyle.version}</version>
639+
</dependency>
640+
<dependency>
641+
<groupId>io.spring.javaformat</groupId>
642+
<artifactId>spring-javaformat-checkstyle</artifactId>
643+
<version>${spring-javaformat-checkstyle.version}</version>
644+
</dependency>
645+
</dependencies>
646+
<executions>
647+
<execution>
648+
<id>checkstyle-validation</id>
649+
<phase>verify</phase>
650+
<inherited>true</inherited>
651+
<configuration>
652+
<skip>${disable.checks}</skip>
653+
<configLocation>src/checkstyle/checkstyle.xml
654+
</configLocation>
655+
<headerLocation>src/checkstyle/checkstyle-header.txt
656+
</headerLocation>
657+
<includeTestSourceDirectory>true
658+
</includeTestSourceDirectory>
659+
<propertyExpansion>
660+
checkstyle.build.directory=${project.build.directory}
661+
checkstyle.suppressions.file=${project.basedir}/src/checkstyle/checkstyle-suppressions.xml
662+
checkstyle.additional.suppressions.file=${project.basedir}/src/checkstyle/checkstyle-suppressions.xml
663+
checkstyle.header.file=${project.basedir}/src/checkstyle/checkstyle-header.txt
664+
</propertyExpansion>
665+
<consoleOutput>true</consoleOutput>
666+
<failsOnError>${maven-checkstyle-plugin.failsOnError}
667+
</failsOnError>
668+
<failOnViolation>
669+
${maven-checkstyle-plugin.failOnViolation}
670+
</failOnViolation>
671+
</configuration>
672+
<goals>
673+
<goal>check</goal>
674+
</goals>
675+
</execution>
676+
</executions>
677+
</plugin>
678+
679+
</plugins>
680+
</build>
681+
</profile>
667682
<profile>
668683
<id>license</id>
669684
<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)