Skip to content

Commit 4d3ebbe

Browse files
committed
Merge branch 'develop'
2 parents ccc0f52 + 8c94ca9 commit 4d3ebbe

File tree

29 files changed

+201
-119
lines changed

29 files changed

+201
-119
lines changed

.github/workflows/heylogs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
uses: s4u/setup-maven-action@v1.18.0
1515

1616
- name: Scan changelog
17-
run: mvn -U com.github.nbbrd.heylogs:heylogs-maven-plugin::scan -Dheylogs.output.file=scan.json -Dheylogs.format.id=json
17+
run: mvn -U com.github.nbbrd.heylogs:heylogs-maven-plugin::scan -Dheylogs.outputFile=scan.json
1818

1919
- name: Create badges endpoint json
2020
run: |

.github/workflows/java8-maven.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ jobs:
9595
- name: Deploy snapshot with Maven if settings defined
9696
run: test ! -f ci.settings.xml || mvn deploy -DskipTests -s ci.settings.xml -P base-deploy,snapshot-deploy,!non-deployable-modules
9797
env:
98-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
99-
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
98+
CENTRAL_PORTAL_USERNAME: ${{ secrets.CENTRAL_PORTAL_USERNAME }}
99+
CENTRAL_PORTAL_TOKEN: ${{ secrets.CENTRAL_PORTAL_TOKEN }}
100100
SIGN_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
101101
SIGN_KEY_PASS: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
102102

@@ -145,8 +145,8 @@ jobs:
145145
- name: Deploy with Maven if settings defined
146146
run: test ! -f ci.settings.xml || mvn deploy -DskipTests -s ci.settings.xml -P base-deploy,release-deploy,!non-deployable-modules
147147
env:
148-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
149-
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
148+
CENTRAL_PORTAL_USERNAME: ${{ secrets.CENTRAL_PORTAL_USERNAME }}
149+
CENTRAL_PORTAL_TOKEN: ${{ secrets.CENTRAL_PORTAL_TOKEN }}
150150
SIGN_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
151151
SIGN_KEY_PASS: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
152152
# Fix https://issues.sonatype.org/browse/OSSRH-66257

CHANGELOG.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
99

10+
## [1.1.0] - 2025-07-02
11+
12+
### Added
13+
14+
- Add parsing of error messages in Maven verify command
15+
- Add option to log errors [#34](https://github.com/nbbrd/nbbrd-maven-tools/issues/34)
16+
17+
### Changed
18+
19+
- Migrate OSSRH to Central Portal
20+
1021
## [1.0.3] - 2025-05-23
1122

1223
### Fixed
@@ -32,7 +43,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
3243

3344
Initial release.
3445

35-
[Unreleased]: https://github.com/nbbrd/nbbrd-maven-tools/compare/v1.0.3...HEAD
46+
[Unreleased]: https://github.com/nbbrd/nbbrd-maven-tools/compare/v1.1.0...HEAD
47+
[1.1.0]: https://github.com/nbbrd/nbbrd-maven-tools/compare/v1.0.3...v1.1.0
3648
[1.0.3]: https://github.com/nbbrd/nbbrd-maven-tools/compare/v1.0.2...v1.0.3
3749
[1.0.2]: https://github.com/nbbrd/nbbrd-maven-tools/compare/v1.0.1...v1.0.2
3850
[1.0.1]: https://github.com/nbbrd/nbbrd-maven-tools/compare/v1.0.0...v1.0.1

ci.settings.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
33
<servers>
44
<server>
5-
<id>ossrh</id>
6-
<username>${env.OSSRH_USERNAME}</username>
7-
<password>${env.OSSRH_TOKEN}</password>
5+
<id>central</id>
6+
<username>${env.CENTRAL_PORTAL_USERNAME}</username>
7+
<password>${env.CENTRAL_PORTAL_TOKEN}</password>
88
</server>
99
</servers>
1010
</settings>

compatibility-api/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>com.github.nbbrd.nbbrd-maven-tools</groupId>
99
<artifactId>nbbrd-maven-tools</artifactId>
10-
<version>1.0.3</version>
10+
<version>1.1.0</version>
1111
</parent>
1212

1313
<artifactId>compatibility-api</artifactId>
@@ -53,7 +53,7 @@
5353
<dependency>
5454
<groupId>org.semver4j</groupId>
5555
<artifactId>semver4j</artifactId>
56-
<version>5.7.0</version>
56+
<version>5.7.1</version>
5757
<exclusions>
5858
<exclusion>
5959
<groupId>org.jetbrains</groupId>

compatibility-api/src/main/java/internal/compatibility/TargetContext.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ public class TargetContext implements ProjectContext {
2020
@lombok.Singular
2121
List<RefVersion> versions;
2222

23+
boolean logErrors;
24+
2325
public static final class Builder implements ProjectContext.Builder<Builder> {
2426
}
2527
}

compatibility-api/src/main/java/internal/compatibility/spi/CommandLineBuild.java

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import nbbrd.compatibility.spi.Build;
99
import nbbrd.design.MightBePromoted;
1010
import nbbrd.design.VisibleForTesting;
11-
import nbbrd.io.sys.EndOfProcessException;
1211
import nbbrd.io.text.TextParser;
1312
import org.checkerframework.checker.nullness.qual.Nullable;
1413

@@ -23,6 +22,8 @@
2322
import java.util.stream.Collector;
2423
import java.util.stream.Stream;
2524

25+
import static internal.compatibility.spi.MvnCommandBuilder.FailStrategy.FAIL_NEVER;
26+
import static java.lang.System.lineSeparator;
2627
import static java.nio.charset.StandardCharsets.UTF_8;
2728
import static java.util.stream.Collectors.*;
2829

@@ -62,21 +63,18 @@ public void restore(@NonNull Path project) throws IOException {
6263
}
6364

6465
@Override
65-
public int verify(@NonNull Path project) throws IOException {
66-
try {
67-
// https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
68-
mvnOf(project)
69-
.goal("clean")
70-
.goal("verify")
71-
.updateSnapshots()
72-
.define("skipTests")
73-
.define("enforcer.skip")
74-
.build()
75-
.collect(toLast(), onEvent);
76-
return 0;
77-
} catch (EndOfProcessException ex) {
78-
return ex.getExitValue();
79-
}
66+
public @Nullable String verify(@NonNull Path project) throws IOException {
67+
// https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
68+
String errorMessage = mvnOf(project)
69+
.goal("clean")
70+
.goal("verify")
71+
.updateSnapshots()
72+
.failStrategy(FAIL_NEVER)
73+
.define("skipTests")
74+
.define("enforcer.skip")
75+
.build()
76+
.collect(joining(lineSeparator()), onEvent);
77+
return !errorMessage.isEmpty() ? errorMessage : null;
8078
}
8179

8280
@Override

compatibility-api/src/main/java/internal/compatibility/spi/MarkdownFormat.java

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,27 @@ private static void printMarkdown(Appendable appendable, Matrix matrix) throws I
106106
}
107107
appendable.append(lineSeparator()).append(Stream.concat(
108108
Stream.of(padRight(label, sizes[0]), padRight(versionLabel, sizes[1])),
109-
IntStream.range(0, matrix.body[i].length).mapToObj(j -> padRight(emoji(matrix.body[i][j], important), sizes[j + 2]))
109+
IntStream.range(0, matrix.body[i].length).mapToObj(j -> padRight(emoji(matrix.body[i][j].status, important), sizes[j + 2]))
110110
).collect(toRow));
111111
}
112112
appendable.append(lineSeparator()).append(lineSeparator());
113+
for (int i = 0; i < bound; i++) {
114+
for (int j = 0; j < matrix.body[i].length; j++) {
115+
String msg = matrix.body[i][j].message;
116+
if (msg != null && !msg.isEmpty()) {
117+
appendable.append("<details><summary>")
118+
.append(matrix.rows.get(i).toProjectLabel())
119+
.append(" @ ")
120+
.append(matrix.rows.get(i).toVersionLabel())
121+
.append(" -> ")
122+
.append(matrix.columns.get(j).toVersionLabel())
123+
.append("</summary>")
124+
.append(msg)
125+
.append("</details>")
126+
.append(lineSeparator());
127+
}
128+
}
129+
}
113130
}
114131

115132
private static String emoji(ExitStatus exitStatus, boolean important) {
@@ -166,6 +183,12 @@ private static Map<URI, List<ReportItem>> groupBySourceUri(Report report) {
166183
return report.getItems().stream().collect(Collectors.groupingBy(ReportItem::getSourceUri));
167184
}
168185

186+
@lombok.Value
187+
private static class Cell {
188+
ExitStatus status;
189+
String message;
190+
}
191+
169192
@lombok.Value
170193
@lombok.Builder
171194
private static class Matrix {
@@ -177,15 +200,15 @@ private static class Matrix {
177200
List<Header> columns;
178201

179202
@NonNull
180-
ExitStatus[][] body;
203+
Cell[][] body;
181204

182205
public static Matrix of(URI sourceUri, List<ReportItem> items) {
183-
Map<URI, Map<RefVersion, Map<RefVersion, ExitStatus>>> plugins = items
206+
Map<URI, Map<RefVersion, Map<RefVersion, Cell>>> plugins = items
184207
.stream()
185208
.collect(
186209
groupingBy(ReportItem::getTargetUri, LinkedHashMap::new,
187210
groupingBy(ReportItem::getTargetVersion, LinkedHashMap::new,
188-
toMap(ReportItem::getSourceVersion, ReportItem::getExitStatus)))
211+
toMap(ReportItem::getSourceVersion, item -> new Cell(item.getExitStatus(), item.getExitMessage()))))
189212
);
190213

191214
Set<RefVersion> versions = items
@@ -202,8 +225,8 @@ public static Matrix of(URI sourceUri, List<ReportItem> items) {
202225
.map(version -> new Header(sourceUri, version))
203226
.collect(toList()))
204227
.body(plugins.values().stream()
205-
.flatMap(reports -> reports.values().stream().map(z -> versions.stream().map(z::get).map(value -> value != null ? value : ExitStatus.SKIPPED).toArray(ExitStatus[]::new)))
206-
.toArray(ExitStatus[][]::new))
228+
.flatMap(reports -> reports.values().stream().map(z -> versions.stream().map(z::get).map(value -> value != null ? value : new Cell(ExitStatus.SKIPPED, null)).toArray(Cell[]::new)))
229+
.toArray(Cell[][]::new))
207230
.build();
208231
}
209232
}

compatibility-api/src/main/java/internal/compatibility/spi/MvnCommandBuilder.java

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package internal.compatibility.spi;
22

3+
import lombok.NonNull;
34
import nbbrd.design.BuilderPattern;
45
import nbbrd.design.VisibleForTesting;
56
import nbbrd.io.sys.OS;
7+
import org.checkerframework.checker.nullness.qual.Nullable;
68

79
import java.nio.file.Path;
810
import java.nio.file.Paths;
@@ -12,15 +14,18 @@
1214
@BuilderPattern(TextCommand.class)
1315
final class MvnCommandBuilder {
1416

15-
private Path binary = null;
17+
public enum FailStrategy {FAIL_AT_END, FAIL_FAST, FAIL_NEVER}
18+
19+
private @Nullable Path binary = null;
1620
private boolean quiet = false;
1721
private boolean batchMode = false;
1822
private boolean updateSnapshots = false;
19-
private Path file = null;
23+
private @Nullable Path file = null;
24+
private @NonNull FailStrategy failStrategy = FailStrategy.FAIL_FAST;
2025
private final List<String> goals = new ArrayList<>();
2126
private final List<String> userProperties = new ArrayList<>();
2227

23-
public MvnCommandBuilder binary(Path binary) {
28+
public MvnCommandBuilder binary(@Nullable Path binary) {
2429
this.binary = binary;
2530
return this;
2631
}
@@ -40,12 +45,17 @@ public MvnCommandBuilder updateSnapshots() {
4045
return this;
4146
}
4247

43-
public MvnCommandBuilder file(Path file) {
48+
public MvnCommandBuilder file(@Nullable Path file) {
4449
this.file = file;
4550
return this;
4651
}
4752

48-
public MvnCommandBuilder goal(String goal) {
53+
public MvnCommandBuilder failStrategy(@NonNull FailStrategy failStrategy) {
54+
this.failStrategy = failStrategy;
55+
return this;
56+
}
57+
58+
public MvnCommandBuilder goal(@NonNull String goal) {
4959
this.goals.add(goal);
5060
return this;
5161
}
@@ -67,6 +77,17 @@ public TextCommand build() {
6777
if (batchMode) result.command("-B");
6878
if (updateSnapshots) result.command("-U");
6979
if (file != null) result.command("-f").command(file.toString());
80+
switch (failStrategy) {
81+
case FAIL_AT_END:
82+
result.command("-fae");
83+
break;
84+
case FAIL_FAST:
85+
result.command("-ff");
86+
break;
87+
case FAIL_NEVER:
88+
result.command("-fn");
89+
break;
90+
}
7091
result.commands(goals);
7192
userProperties.forEach(userProperty -> result.command("-D").command("\"" + userProperty + "\""));
7293
return result.build();

compatibility-api/src/main/java/internal/compatibility/spi/TextCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class TextCommand {
2121
@lombok.Builder.Default
2222
Charset charset = StandardCharsets.UTF_8;
2323

24-
public <X> X collect(@NonNull Collector<String, ?, X> collector, @NonNull Consumer<? super String> consumer) throws IOException {
24+
public <X> X collect(@NonNull Collector<? super String, ?, X> collector, @NonNull Consumer<? super String> consumer) throws IOException {
2525
consumer.accept(String.join(" ", commands));
2626
return TextParser.onParsingLines(collector).parseProcess(commands, charset);
2727
}

0 commit comments

Comments
 (0)