Skip to content

Commit 8bdc23a

Browse files
committed
#979: Merged with upstream
1 parent 1c04017 commit 8bdc23a

File tree

64 files changed

+341
-46
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+341
-46
lines changed

versions-common/pom.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,8 @@
188188
<plugin>
189189
<artifactId>maven-javadoc-plugin</artifactId>
190190
<configuration>
191-
<!-- Exclude packages generated by Modello in JavaDocs -->
192-
<excludePackageNames>org.codehaus.mojo.versions.model,
193-
org.codehaus.mojo.versions.model.io.stax,
194-
org.codehaus.mojo.versions.utils</excludePackageNames>
191+
<!-- sources contain both generated model and non-generated classes -->
192+
<doclint>all,-missing</doclint>
195193
</configuration>
196194
</plugin>
197195
</plugins>

versions-common/src/main/java/org/codehaus/mojo/versions/api/AbstractVersionDetails.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,7 @@ public static boolean isPreReleaseVersion(String version) {
8989
protected boolean verboseDetail = true;
9090

9191
/**
92-
* <<<<<<< HEAD
9392
* Creates a new, empty instance.
94-
* =======
95-
* Creates a new instance
96-
* >>>>>>> 55436036 (#979: overhaul of the updates logger; added json and csv + a new appendable xml which records multiple executions)
9793
*/
9894
protected AbstractVersionDetails() {}
9995

versions-common/src/main/java/org/codehaus/mojo/versions/recording/ChangeRecorderRenderer.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,21 @@
1111
* @since 2.20.0
1212
*/
1313
public interface ChangeRecorderRenderer {
14+
/**
15+
* Reads the change log from the given path.
16+
*
17+
* @param path the path to read from
18+
* @return the read change log
19+
* @throws IOException if an I/O error occurs
20+
*/
1421
ChangeRecorderLog read(Path path) throws IOException;
1522

23+
/**
24+
* Writes the change log to the given path.
25+
*
26+
* @param path the path to write to
27+
* @param log the change log to write
28+
* @throws IOException if an I/O error occurs
29+
*/
1630
void write(Path path, ChangeRecorderLog log) throws IOException;
1731
}

versions-common/src/main/java/org/codehaus/mojo/versions/recording/CsvVersionChangeRecorderFactory.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
*/
1717
@Named("csv")
1818
public class CsvVersionChangeRecorderFactory implements VersionChangeRecorderFactory {
19+
/**
20+
* Create a new instance.
21+
*/
22+
public CsvVersionChangeRecorderFactory() {}
23+
1924
@Override
2025
public synchronized VersionChangeRecorder create(
2126
MavenSession mavenSession, MojoExecution mojoExecution, Map<String, String> changeRendererOptions) {

versions-common/src/main/java/org/codehaus/mojo/versions/recording/JsonVersionChangeRecorderFactory.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@
1616
*/
1717
@Named("json")
1818
public class JsonVersionChangeRecorderFactory implements VersionChangeRecorderFactory {
19+
/**
20+
* Create a new instance
21+
*/
22+
public JsonVersionChangeRecorderFactory() {}
23+
1924
@Override
2025
public synchronized VersionChangeRecorder create(
2126
MavenSession mavenSession, MojoExecution mojoExecution, Map<String, String> changeRendererOptions) {

versions-common/src/main/java/org/codehaus/mojo/versions/recording/NoneVersionChangeRecorderFactory.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,18 @@
1212
import org.codehaus.mojo.versions.api.recording.VersionChangeRecorderFactory;
1313
import org.codehaus.mojo.versions.model.VersionChange;
1414

15+
/**
16+
* A {@link VersionChangeRecorderFactory} that creates a no-op {@link VersionChangeRecorder}.
17+
* This implementation does not record any changes or write any report.
18+
* It can be used when version change recording is not desired.
19+
*/
1520
@Named("none")
1621
public class NoneVersionChangeRecorderFactory implements VersionChangeRecorderFactory {
22+
/**
23+
* Creates a new instance
24+
*/
25+
public NoneVersionChangeRecorderFactory() {}
26+
1727
@Override
1828
public VersionChangeRecorder create(
1929
MavenSession mavenSession, MojoExecution mojoExecution, Map<String, String> changeRendererOptions) {

versions-common/src/main/java/org/codehaus/mojo/versions/recording/VersionChangeFileHelper.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,23 @@
44
import java.nio.file.Files;
55
import java.nio.file.Path;
66

7+
/**
8+
* Helper class for file operations related to version change recording.
9+
*
10+
* @since 2.20.0
11+
*/
712
public class VersionChangeFileHelper {
13+
private VersionChangeFileHelper() {
14+
// utility class
15+
}
16+
17+
/**
18+
* Creates a file at the specified path, including any necessary but nonexistent parent directories.
19+
* If the file already exists, no action is taken.
20+
*
21+
* @param path the path of the file to create
22+
* @throws IOException if an I/O error occurs
23+
*/
824
public static void createFile(Path path) throws IOException {
925
Path parent = path.getParent();
1026
if (parent != null) {

versions-common/src/main/java/org/codehaus/mojo/versions/recording/XmlVersionChangeRecorderFactory.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,24 @@
1616
/**
1717
* A {@link VersionChangeRecorderFactory} for rendering the updates into the format compatible
1818
* with the legacy {@code http://www.mojohaus.org/versions-maven-plugin/schema/updates/2.0} schema
19+
* and the current {@code http://www.mojohaus.org/versions-maven-plugin/schema/updates/3.0} schema.
20+
* The choice of the schema version is controlled by the {@code legacy} option:
21+
* <ul>
22+
* <li>If the {@code legacy} option is not provided or set to {@code true
23+
* (ignoring case)}, the legacy schema is used.</li>
24+
* <li>If the {@code legacy} option is set to {@code false} (ign
25+
* oring case), the current schema is used.</li>
26+
* </ul>
27+
*
28+
* @since 2.20.0
1929
*/
2030
@Named("xml")
2131
public class XmlVersionChangeRecorderFactory implements VersionChangeRecorderFactory {
32+
/**
33+
* Create a new instance
34+
*/
35+
public XmlVersionChangeRecorderFactory() {}
36+
2237
@Override
2338
public VersionChangeRecorder create(
2439
MavenSession mavenSession, MojoExecution mojoExecution, Map<String, String> options) {

versions-common/src/main/java/org/codehaus/mojo/versions/recording/csv/ChangeRecorderLogCsvDeserializer.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,22 @@
1616
import org.codehaus.mojo.versions.model.VersionsExecution;
1717
import org.codehaus.mojo.versions.model.xjb.ZonedDateTimeXmlAdapter;
1818

19+
/**
20+
* A CSV deserializer for {@link ChangeRecorderLog}.
21+
*
22+
* @since 2.20.0
23+
*/
1924
public class ChangeRecorderLogCsvDeserializer extends StdDeserializer<ChangeRecorderLog> {
20-
25+
/**
26+
* The object factory to use to create model instances.
27+
*/
2128
private final ObjectFactory objectFactory;
2229

30+
/**
31+
* Creates a new deserializer.
32+
*
33+
* @param objectFactory the object factory to use to create model instances
34+
*/
2335
public ChangeRecorderLogCsvDeserializer(ObjectFactory objectFactory) {
2436
super(VersionsExecution.class);
2537
this.objectFactory = objectFactory;

versions-common/src/main/java/org/codehaus/mojo/versions/recording/csv/ChangeRecorderLogCsvModule.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,18 @@
44
import org.codehaus.mojo.versions.model.ChangeRecorderLog;
55
import org.codehaus.mojo.versions.model.ObjectFactory;
66

7+
/**
8+
* A Jackson module for CSV serialization and deserialization of {@link ChangeRecorderLog}.
9+
* It registers the appropriate serializer and deserializer.
10+
*
11+
* @since 2.20.0
12+
*/
713
public class ChangeRecorderLogCsvModule extends SimpleModule {
14+
/**
15+
* Creates a new module.
16+
*
17+
* @param objectFactory the object factory to use to create model instances during deserialization
18+
*/
819
public ChangeRecorderLogCsvModule(ObjectFactory objectFactory) {
920
addSerializer(ChangeRecorderLog.class, new ChangeRecorderLogCsvSerializer());
1021
addDeserializer(ChangeRecorderLog.class, new ChangeRecorderLogCsvDeserializer(objectFactory));

0 commit comments

Comments
 (0)