You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2024/05/03 15:40:08 UTC
(maven-changelog-plugin) branch maven-3.6.3 updated (51d0118 -> dc1a432)
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a change to branch maven-3.6.3
in repository https://gitbox.apache.org/repos/asf/maven-changelog-plugin.git
discard 51d0118 [MCHANGELOG-151] Code cleanup and update remaining dependencies
new dc1a432 [MCHANGELOG-151] Code cleanup and update remaining dependencies
This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version. This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:
* -- * -- B -- O -- O -- O (51d0118)
\
N -- N -- N refs/heads/maven-3.6.3 (dc1a432)
You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.
Any revisions marked "omit" are not gone; other references still
refer to them. Any revisions marked "discard" are gone forever.
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
pom.xml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(maven-changelog-plugin) 01/01: [MCHANGELOG-151] Code cleanup and update remaining dependencies
Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch maven-3.6.3
in repository https://gitbox.apache.org/repos/asf/maven-changelog-plugin.git
commit dc1a4326949092a412a9f589278640b7fb57defe
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Fri May 3 17:30:15 2024 +0200
[MCHANGELOG-151] Code cleanup and update remaining dependencies
---
pom.xml | 21 ++++++-------
.../maven/plugin/changelog/ChangeLogReport.java | 35 ++++++++--------------
.../plugin/changelog/DeveloperActivityReport.java | 19 ++----------
.../plugin/changelog/FileActivityComparator.java | 22 +-------------
.../maven/plugin/changelog/FileActivityReport.java | 18 ++---------
.../command/info/SvnInfoCommandExpanded.java | 5 +---
.../maven/plugin/changelog/ChangeLogTest.java | 4 +--
7 files changed, 33 insertions(+), 91 deletions(-)
diff --git a/pom.xml b/pom.xml
index bcc028a..393d0e3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -145,8 +145,7 @@ under the License.
<properties>
<javaVersion>8</javaVersion>
- <maven-scm.version>1.12.2</maven-scm.version>
- <doxiaVersion>1.11.1</doxiaVersion>
+ <maven-scm.version>1.13.0</maven-scm.version>
<mavenVersion>3.9.6</mavenVersion>
<!-- used in ITs -->
<sitePluginVersion>${version.maven-site-plugin}</sitePluginVersion>
@@ -201,12 +200,12 @@ under the License.
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-api</artifactId>
- <version>3.1.0</version>
+ <version>3.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.reporting</groupId>
<artifactId>maven-reporting-impl</artifactId>
- <version>3.1.0</version>
+ <version>3.2.0</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
@@ -219,7 +218,7 @@ under the License.
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-sink-api</artifactId>
- <version>${doxiaVersion}</version>
+ <version>1.12.0</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
@@ -230,7 +229,7 @@ under the License.
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-site-renderer</artifactId>
- <version>${doxiaVersion}</version>
+ <version>1.11.1</version>
<exclusions>
<exclusion>
<groupId>org.codehaus.plexus</groupId>
@@ -241,7 +240,7 @@ under the License.
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-decoration-model</artifactId>
- <version>${doxiaVersion}</version>
+ <version>1.11.1</version>
</dependency>
<!-- scm -->
@@ -336,7 +335,10 @@ under the License.
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
- <version>3.3.1</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.plexus</groupId>
+ <artifactId>plexus-xml</artifactId>
</dependency>
<!-- test dependencies -->
@@ -361,7 +363,6 @@ under the License.
<dependency>
<groupId>org.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.plexus</artifactId>
- <version>0.3.5</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -413,7 +414,7 @@ under the License.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>l10n-maven-plugin</artifactId>
- <version>1.0-alpha-2</version>
+ <version>1.0.0</version>
<configuration>
<locales>
<locale>de</locale>
diff --git a/src/main/java/org/apache/maven/plugin/changelog/ChangeLogReport.java b/src/main/java/org/apache/maven/plugin/changelog/ChangeLogReport.java
index cd870b8..d1dbdce 100644
--- a/src/main/java/org/apache/maven/plugin/changelog/ChangeLogReport.java
+++ b/src/main/java/org/apache/maven/plugin/changelog/ChangeLogReport.java
@@ -22,18 +22,16 @@ import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
import java.io.IOException;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.net.URLEncoder;
+import java.nio.file.Files;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
@@ -448,10 +446,9 @@ public class ChangeLogReport extends AbstractMavenReport {
if (systemProperties != null) {
// Add all system properties configured by the user
- Iterator<?> iter = systemProperties.keySet().iterator();
- while (iter.hasNext()) {
- String key = (String) iter.next();
+ for (Object o : systemProperties.keySet()) {
+ String key = (String) o;
String value = systemProperties.getProperty(key);
@@ -536,8 +533,6 @@ public class ChangeLogReport extends AbstractMavenReport {
try {
writeChangelogXml(changelogList);
- } catch (FileNotFoundException e) {
- throw new MavenReportException("Can't create " + outputXML.getAbsolutePath(), e);
} catch (UnsupportedEncodingException e) {
throw new MavenReportException("Can't create " + outputXML.getAbsolutePath(), e);
} catch (IOException e) {
@@ -580,8 +575,8 @@ public class ChangeLogReport extends AbstractMavenReport {
// pw.flush();
// pw.close();
// MCHANGELOG-86
- Writer writer =
- WriterFactory.newWriter(new BufferedOutputStream(new FileOutputStream(outputXML)), getOutputEncoding());
+ Writer writer = WriterFactory.newWriter(
+ new BufferedOutputStream(Files.newOutputStream(outputXML.toPath())), getOutputEncoding());
writer.write(changelogXml.toString());
writer.flush();
writer.close();
@@ -725,7 +720,7 @@ public class ChangeLogReport extends AbstractMavenReport {
null,
false,
null);
- if (infoScmResult.getInfoItems().size() == 0) {
+ if (infoScmResult.getInfoItems().isEmpty()) {
throw new ScmException("There is no tag named '" + tag + "' in the Subversion repository.");
}
InfoItem infoItem = infoScmResult.getInfoItems().get(0);
@@ -950,13 +945,13 @@ public class ChangeLogReport extends AbstractMavenReport {
}
String scmConnection = project.getScm().getConnection();
- if ((scmConnection != null && !scmConnection.isEmpty()) && "connection".equals(connectionType.toLowerCase())) {
+ if ((scmConnection != null && !scmConnection.isEmpty()) && "connection".equalsIgnoreCase(connectionType)) {
connection = scmConnection;
}
String scmDeveloper = project.getScm().getDeveloperConnection();
if ((scmDeveloper != null && !scmDeveloper.isEmpty())
- && "developerconnection".equals(connectionType.toLowerCase())) {
+ && "developerconnection".equalsIgnoreCase(connectionType)) {
connection = scmDeveloper;
}
@@ -1215,11 +1210,7 @@ public class ChangeLogReport extends AbstractMavenReport {
initReportUrls();
List<ChangeSet> sortedEntries = new ArrayList<>(entries);
- Collections.sort(sortedEntries, new Comparator<ChangeSet>() {
- public int compare(ChangeSet changeSet0, ChangeSet changeSet1) {
- return changeSet1.getDate().compareTo(changeSet0.getDate());
- }
- });
+ sortedEntries.sort((changeSet0, changeSet1) -> changeSet1.getDate().compareTo(changeSet0.getDate()));
for (ChangeSet entry : sortedEntries) {
doChangedSetDetail(entry, sink);
@@ -1561,7 +1552,7 @@ public class ChangeLogReport extends AbstractMavenReport {
* @param target target file to create the absolute path to
*/
private String getAbsolutePath(final String base, final String target) {
- String absPath = "";
+ StringBuilder absPath = new StringBuilder();
StringTokenizer baseTokens =
new StringTokenizer(sinkFileNamePattern.matcher(base).replaceAll("/"), "/", true);
@@ -1578,11 +1569,11 @@ public class ChangeLogReport extends AbstractMavenReport {
break;
}
- absPath += baseToken;
+ absPath.append(baseToken);
}
- if (!absPath.endsWith("/")) {
- absPath += "/";
+ if (!absPath.toString().endsWith("/")) {
+ absPath.append("/");
}
String newTarget = target;
diff --git a/src/main/java/org/apache/maven/plugin/changelog/DeveloperActivityReport.java b/src/main/java/org/apache/maven/plugin/changelog/DeveloperActivityReport.java
index 5e086fc..4973461 100644
--- a/src/main/java/org/apache/maven/plugin/changelog/DeveloperActivityReport.java
+++ b/src/main/java/org/apache/maven/plugin/changelog/DeveloperActivityReport.java
@@ -218,15 +218,7 @@ public class DeveloperActivityReport extends ChangeLogReport {
*/
private void countDevCommits(Collection<ChangeSet> entries) {
for (ChangeSet entry : entries) {
- String developer = entry.getAuthor();
-
- List<ChangeSet> list = commits.get(developer);
-
- if (list == null) {
- list = new LinkedList<>();
- commits.put(developer, list);
- }
-
+ List<ChangeSet> list = commits.computeIfAbsent(entry.getAuthor(), k -> new LinkedList<>());
list.add(entry);
}
}
@@ -239,14 +231,7 @@ public class DeveloperActivityReport extends ChangeLogReport {
private void countDevFiles(Collection<ChangeSet> entries) {
for (ChangeSet entry : entries) {
String developer = entry.getAuthor();
-
- Map<String, ChangeFile> filesMap = files.get(developer);
-
- if (filesMap == null) {
- filesMap = new HashMap<>();
- files.put(developer, filesMap);
- }
-
+ Map<String, ChangeFile> filesMap = files.computeIfAbsent(developer, k -> new HashMap<>());
for (ChangeFile file : entry.getFiles()) {
filesMap.put(file.getName(), file);
}
diff --git a/src/main/java/org/apache/maven/plugin/changelog/FileActivityComparator.java b/src/main/java/org/apache/maven/plugin/changelog/FileActivityComparator.java
index 34e95ae..adc76bd 100644
--- a/src/main/java/org/apache/maven/plugin/changelog/FileActivityComparator.java
+++ b/src/main/java/org/apache/maven/plugin/changelog/FileActivityComparator.java
@@ -34,7 +34,7 @@ public class FileActivityComparator implements Comparator<List<ChangeFile>> {
* {@inheritDoc}
*/
public int compare(List<ChangeFile> list1, List<ChangeFile> list2) throws ClassCastException {
- int returnValue = sortByCommits(list1, list2);
+ int returnValue = Integer.compare(list2.size(), list1.size());
if (returnValue != 0) {
return returnValue;
@@ -49,25 +49,6 @@ public class FileActivityComparator implements Comparator<List<ChangeFile>> {
return sortByName(list1, list2);
}
- /**
- * compares list1 and list2 by the number of commits
- *
- * @param list1 the first object in a compare statement
- * @param list2 the object to compare list1 against
- * @return an integer describing the order comparison of list1 and list2
- */
- private int sortByCommits(List<ChangeFile> list1, List<ChangeFile> list2) {
- if (list1.size() > list2.size()) {
- return -1;
- }
-
- if (list1.size() < list2.size()) {
- return 1;
- }
-
- return 0;
- }
-
/**
* compares list1 and list2 by comparing their revision code
*
@@ -77,7 +58,6 @@ public class FileActivityComparator implements Comparator<List<ChangeFile>> {
*/
private int sortByRevision(List<ChangeFile> list1, List<ChangeFile> list2) {
String revision1 = getLatestRevision(list1);
-
String revision2 = getLatestRevision(list2);
if (revision1 == null) {
diff --git a/src/main/java/org/apache/maven/plugin/changelog/FileActivityReport.java b/src/main/java/org/apache/maven/plugin/changelog/FileActivityReport.java
index 1845137..5eb8991 100644
--- a/src/main/java/org/apache/maven/plugin/changelog/FileActivityReport.java
+++ b/src/main/java/org/apache/maven/plugin/changelog/FileActivityReport.java
@@ -19,7 +19,6 @@
package org.apache.maven.plugin.changelog;
import java.util.Collection;
-import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
@@ -194,27 +193,16 @@ public class FileActivityReport extends ChangeLogReport {
* @return list of changed files within the SCM with the number of times changed in descending order
*/
private List<List<ChangeFile>> getOrderedFileList(Collection<ChangeSet> entries) {
- List<List<ChangeFile>> list = new LinkedList<>();
-
Map<String, List<ChangeFile>> map = new HashMap<>();
-
for (ChangeSet entry : entries) {
for (ChangeFile file : entry.getFiles()) {
- List<ChangeFile> revisions = map.get(file.getName());
-
- if (revisions == null) {
- revisions = new LinkedList<>();
- map.put(file.getName(), revisions);
- }
-
+ List<ChangeFile> revisions = map.computeIfAbsent(file.getName(), k -> new LinkedList<>());
revisions.add(file);
}
}
- list.addAll(map.values());
-
- Collections.sort(list, new FileActivityComparator());
-
+ List<List<ChangeFile>> list = new LinkedList<>(map.values());
+ list.sort(new FileActivityComparator());
return list;
}
}
diff --git a/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/info/SvnInfoCommandExpanded.java b/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/info/SvnInfoCommandExpanded.java
index 6a525a2..80db33e 100644
--- a/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/info/SvnInfoCommandExpanded.java
+++ b/src/main/java/org/apache/maven/scm/provider/svn/svnexe/command/info/SvnInfoCommandExpanded.java
@@ -119,10 +119,7 @@ public class SvnInfoCommandExpanded extends AbstractCommand implements SvnComman
cl.createArg().setValue(revision);
}
- Iterator<File> it = fileSet.getFileList().iterator();
-
- while (it.hasNext()) {
- File file = it.next();
+ for (File file : fileSet.getFileList()) {
if (repository == null) {
cl.createArg().setValue(file.getPath());
} else {
diff --git a/src/test/java/org/apache/maven/plugin/changelog/ChangeLogTest.java b/src/test/java/org/apache/maven/plugin/changelog/ChangeLogTest.java
index 7251860..819e1d7 100644
--- a/src/test/java/org/apache/maven/plugin/changelog/ChangeLogTest.java
+++ b/src/test/java/org/apache/maven/plugin/changelog/ChangeLogTest.java
@@ -19,8 +19,8 @@
package org.apache.maven.plugin.changelog;
import java.io.File;
-import java.io.FileInputStream;
import java.io.InputStream;
+import java.nio.file.Files;
import java.text.SimpleDateFormat;
import java.util.List;
@@ -149,7 +149,7 @@ public class ChangeLogTest {
private List<ChangeLogSet> readChangeLogXml(String filename) throws Exception {
File inputFile = new File(getBasedir(), "src/test/changelog-xml/" + filename);
- InputStream in = new FileInputStream(inputFile);
+ InputStream in = Files.newInputStream(inputFile.toPath());
return ChangeLog.loadChangedSets(in);
}