Are these copyrights really supposed to be so ancient? The copyright year goes in the NOTICE.txt file these days anyways, so those could be simplified. — Matt Sicker
> On Jan 21, 2023, at 00:12, rgo...@apache.org wrote: > > This is an automated email from the ASF dual-hosted git repository. > > rgoers pushed a commit to branch PR20 > in repository https://gitbox.apache.org/repos/asf/logging-log4j-tools.git > > commit 1642bc8ee6210fc75dff3e9f319f853e76d65ee5 > Author: Ralph Goers <rgo...@apache.org> > AuthorDate: Fri Jan 20 23:08:37 2023 -0700 > > #20 - Add Maven changelog plugins > --- > .../changelog/exporter/ChangelogExporter.java | 7 +- > .../changelog/exporter/ChangelogExporterArgs.java | 6 +- > .../changelog/releaser/ChangelogReleaser.java | 6 +- > .../changelog/releaser/ChangelogReleaserArgs.java | 6 +- > log4j-maven-changelog-plugin/pom.xml | 142 +++++++++++++++++++++ > .../java/org/apache/logging/log4j/ExportMojo.java | 68 ++++++++++ > .../java/org/apache/logging/log4j/ReleaseMojo.java | 71 +++++++++++ > pom.xml | 4 +- > 8 files changed, 299 insertions(+), 11 deletions(-) > > diff --git > a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/exporter/ChangelogExporter.java > > b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/exporter/ChangelogExporter.java > index 236dcea..82c0c17 100644 > --- > a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/exporter/ChangelogExporter.java > +++ > b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/exporter/ChangelogExporter.java > @@ -34,10 +34,10 @@ public final class ChangelogExporter { > private ChangelogExporter() {} > > public static void main(final String[] mainArgs) { > + performExport(ChangelogExporterArgs.fromSystemProperties()); > + } > > - // Read arguments > - final ChangelogExporterArgs args = > ChangelogExporterArgs.fromSystemProperties(); > - > + public static void performExport(final ChangelogExporterArgs args) { > // Find release directories > final List<Path> releaseDirectories = findReleaseDirectories(args); > final int releaseDirectoryCount = releaseDirectories.size(); > @@ -107,7 +107,6 @@ public final class ChangelogExporter { > // Export the release index > final Path changelogIndexTemplateFile = > ChangelogFiles.indexTemplateFile(args.changelogDirectory); > exportIndex(args.outputDirectory, changelogReleases, > changelogIndexTemplateFile); > - > } > > private static List<Path> findReleaseDirectories(ChangelogExporterArgs > args) { > diff --git > a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/exporter/ChangelogExporterArgs.java > > b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/exporter/ChangelogExporterArgs.java > index 8d79d9a..32a4878 100644 > --- > a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/exporter/ChangelogExporterArgs.java > +++ > b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/exporter/ChangelogExporterArgs.java > @@ -20,7 +20,7 @@ import java.nio.file.Path; > > import static > org.apache.logging.log4j.changelog.util.PropertyUtils.requireNonBlankPathProperty; > > -final class ChangelogExporterArgs { > +public final class ChangelogExporterArgs { > > final Path changelogDirectory; > > @@ -37,4 +37,8 @@ final class ChangelogExporterArgs { > return new ChangelogExporterArgs(changelogDirectory, outputDirectory); > } > > + public static ChangelogExporterArgs fromArgs(final Path > changelogDirectory, final Path outputDirectory) { > + return new ChangelogExporterArgs(changelogDirectory, > outputDirectory); > + } > + > } > diff --git > a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/releaser/ChangelogReleaser.java > > b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/releaser/ChangelogReleaser.java > index 55b4fca..02268b3 100644 > --- > a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/releaser/ChangelogReleaser.java > +++ > b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/releaser/ChangelogReleaser.java > @@ -35,9 +35,10 @@ public final class ChangelogReleaser { > > public static void main(final String[] mainArgs) throws Exception { > > - // Read arguments > - final ChangelogReleaserArgs args = > ChangelogReleaserArgs.fromSystemProperties(); > + performRelease(ChangelogReleaserArgs.fromSystemProperties()); > + } > > + public static void performRelease(final ChangelogReleaserArgs args) > throws Exception { > // Read the release date and version > final String releaseDate = ISO_DATE.format(LocalDate.now()); > final int releaseVersionMajor = > VersionUtils.versionMajor(args.releaseVersion); > @@ -53,7 +54,6 @@ public final class ChangelogReleaser { > > // Write the release changelog template > populateReleaseChangelogTemplateFile(unreleasedDirectory, > releaseDirectory); > - > } > > private static void populateChangelogEntryFiles( > diff --git > a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/releaser/ChangelogReleaserArgs.java > > b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/releaser/ChangelogReleaserArgs.java > index f6bf6cb..7a47c3c 100644 > --- > a/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/releaser/ChangelogReleaserArgs.java > +++ > b/log4j-changelog/src/main/java/org/apache/logging/log4j/changelog/releaser/ChangelogReleaserArgs.java > @@ -22,7 +22,7 @@ import static > org.apache.logging.log4j.changelog.util.PropertyUtils.requireNonBl > import static > org.apache.logging.log4j.changelog.util.PropertyUtils.requireNonBlankStringProperty; > import static > org.apache.logging.log4j.changelog.util.VersionUtils.requireSemanticVersioning; > > -final class ChangelogReleaserArgs { > +public final class ChangelogReleaserArgs { > > final Path changelogDirectory; > > @@ -41,4 +41,8 @@ final class ChangelogReleaserArgs { > return new ChangelogReleaserArgs(changelogDirectory, releaseVersion); > } > > + public static ChangelogReleaserArgs fromArgs(final Path > changelogDirectory, final String releaseVersion) { > + return new ChangelogReleaserArgs(changelogDirectory, releaseVersion); > + } > + > } > diff --git a/log4j-maven-changelog-plugin/pom.xml > b/log4j-maven-changelog-plugin/pom.xml > new file mode 100644 > index 0000000..7dc4ea6 > --- /dev/null > +++ b/log4j-maven-changelog-plugin/pom.xml > @@ -0,0 +1,142 @@ > +<?xml version="1.0" encoding="UTF-8"?> > +<!-- > + Licensed to the Apache Software Foundation (ASF) under one or more > + contributor license agreements. See the NOTICE file distributed with > + this work for additional information regarding copyright ownership. > + The ASF licenses this file to You under the Apache License, Version 2.0 > + (the "License"); you may not use this file except in compliance with > + the License. You may obtain a copy of the License at > + > + https://www.apache.org/licenses/LICENSE-2.0 > + > + Unless required by applicable law or agreed to in writing, software > + distributed under the License is distributed on an "AS IS" BASIS, > + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > + See the License for the specific language governing permissions and > + limitations under the License. > +--> > +<project xmlns="http://maven.apache.org/POM/4.0.0" > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" > + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 > http://maven.apache.org/xsd/maven-4.0.0.xsd"> > + <modelVersion>4.0.0</modelVersion> > + <parent> > + <groupId>org.apache.logging.log4j</groupId> > + <artifactId>log4j-tools-parent</artifactId> > + <version>${revision}</version> > + <relativePath>../log4j-tools-parent/pom.xml</relativePath> > + </parent> > + <artifactId>log4j-maven-changelog-plugin</artifactId> > + <packaging>maven-plugin</packaging> > + > + <name>log4j-maven-changelog-plugin Maven Plugin</name> > + > + <!-- FIXME change it to the project's website --> > + <url>http://maven.apache.org</url> > + > + <properties> > + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> > + </properties> > + > + <dependencyManagement> > + <dependencies> > + <dependency> > + <groupId>org.codehaus.plexus</groupId> > + <artifactId>plexus-utils</artifactId> > + <version>3.3.1</version> > + </dependency> > + </dependencies> > + </dependencyManagement> > + > + <dependencies> > + <dependency> > + <groupId>org.apache.maven</groupId> > + <artifactId>maven-plugin-api</artifactId> > + <version>3.8.7</version> > + </dependency> > + <dependency> > + <groupId>org.apache.maven.plugin-tools</groupId> > + <artifactId>maven-plugin-annotations</artifactId> > + <version>3.6.4</version> > + <scope>provided</scope> > + </dependency> > + <dependency> > + <groupId>org.codehaus.plexus</groupId> > + <artifactId>plexus-utils</artifactId> > + <version>3.3.1</version> > + </dependency> > + <dependency> > + <groupId>org.apache.logging.log4j</groupId> > + <artifactId>log4j-changelog</artifactId> > + <version>${project.version}</version> > + </dependency> > + <dependency> > + <groupId>junit</groupId> > + <artifactId>junit</artifactId> > + <version>4.8.2</version> > + <scope>test</scope> > + </dependency> > + </dependencies> > + > + <build> > + <plugins> > + <plugin> > + <groupId>org.apache.maven.plugins</groupId> > + <artifactId>maven-plugin-plugin</artifactId> > + <version>3.5</version> > + <configuration> > + <goalPrefix>log4j-changelog</goalPrefix> > + <skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound> > + <mojoDependencies> > + </mojoDependencies> > + </configuration> > + <executions> > + <execution> > + <id>mojo-descriptor</id> > + <goals> > + <goal>descriptor</goal> > + </goals> > + </execution> > + </executions> > + </plugin> > + </plugins> > + </build> > + <profiles> > + <profile> > + <id>run-its</id> > + <build> > + > + <plugins> > + <plugin> > + <groupId>org.apache.maven.plugins</groupId> > + <artifactId>maven-invoker-plugin</artifactId> > + <version>1.7</version> > + <configuration> > + <debug>true</debug> > + > <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo> > + <pomIncludes> > + <pomInclude>*/pom.xml</pomInclude> > + </pomIncludes> > + <postBuildHookScript>verify</postBuildHookScript> > + > <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath> > + <settingsFile>src/it/settings.xml</settingsFile> > + <goals> > + <goal>clean</goal> > + <goal>test-compile</goal> > + </goals> > + </configuration> > + <executions> > + <execution> > + <id>integration-test</id> > + <goals> > + <goal>install</goal> > + <goal>integration-test</goal> > + <goal>verify</goal> > + </goals> > + </execution> > + </executions> > + </plugin> > + </plugins> > + > + </build> > + </profile> > + </profiles> > +</project> > diff --git > a/log4j-maven-changelog-plugin/src/main/java/org/apache/logging/log4j/ExportMojo.java > > b/log4j-maven-changelog-plugin/src/main/java/org/apache/logging/log4j/ExportMojo.java > new file mode 100644 > index 0000000..99919a5 > --- /dev/null > +++ > b/log4j-maven-changelog-plugin/src/main/java/org/apache/logging/log4j/ExportMojo.java > @@ -0,0 +1,68 @@ > +/* > + * Licensed to the Apache Software Foundation (ASF) under one or more > + * contributor license agreements. See the NOTICE file distributed with > + * this work for additional information regarding copyright ownership. > + * The ASF licenses this file to You under the Apache license, Version 2.0 > + * (the "License"); you may not use this file except in compliance with > + * the License. You may obtain a copy of the License at > + * > + * http://www.apache.org/licenses/LICENSE-2.0 > + * > + * Unless required by applicable law or agreed to in writing, software > + * distributed under the License is distributed on an "AS IS" BASIS, > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > + * See the license for the specific language governing permissions and > + * limitations under the license. > + */ > +package org.apache.logging.log4j; > + > +/* > + * Copyright 2001-2005 The Apache Software Foundation. > + * > + * Licensed under the Apache License, Version 2.0 (the "License"); > + * you may not use this file except in compliance with the License. > + * You may obtain a copy of the License at > + * > + * http://www.apache.org/licenses/LICENSE-2.0 > + * > + * Unless required by applicable law or agreed to in writing, software > + * distributed under the License is distributed on an "AS IS" BASIS, > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > + * See the License for the specific language governing permissions and > + * limitations under the License. > + */ > + > +import java.io.File; > + > +import org.apache.logging.log4j.changelog.exporter.ChangelogExporter; > +import org.apache.logging.log4j.changelog.exporter.ChangelogExporterArgs; > + > +import org.apache.maven.plugin.AbstractMojo; > +import org.apache.maven.plugin.MojoExecutionException; > +import org.apache.maven.plugins.annotations.LifecyclePhase; > +import org.apache.maven.plugins.annotations.Mojo; > +import org.apache.maven.plugins.annotations.Parameter; > + > +/** > + * Goal which creates a changelog. > + */ > +@Mojo(name = "export", defaultPhase = LifecyclePhase.PRE_SITE) > +public class ExportMojo extends AbstractMojo { > + /** > + * Location of the file. > + */ > + @Parameter(defaultValue = > "${project.build.directory}/generated-sources/site/asciidoc/changelog", > + property = "outputDir", required = true) > + private File outputDirectory; > + > + /** > + * Location of the file. > + */ > + @Parameter(defaultValue = "${project.basedir}/src/changelog", property = > "changeLogDir", required = true) > + private File changeLogDirectory; > + > + public void execute() throws MojoExecutionException { > + > ChangelogExporter.performExport(ChangelogExporterArgs.fromArgs(changeLogDirectory.toPath(), > + outputDirectory.toPath())); > + } > +} > diff --git > a/log4j-maven-changelog-plugin/src/main/java/org/apache/logging/log4j/ReleaseMojo.java > > b/log4j-maven-changelog-plugin/src/main/java/org/apache/logging/log4j/ReleaseMojo.java > new file mode 100644 > index 0000000..001a692 > --- /dev/null > +++ > b/log4j-maven-changelog-plugin/src/main/java/org/apache/logging/log4j/ReleaseMojo.java > @@ -0,0 +1,71 @@ > +/* > + * Licensed to the Apache Software Foundation (ASF) under one or more > + * contributor license agreements. See the NOTICE file distributed with > + * this work for additional information regarding copyright ownership. > + * The ASF licenses this file to You under the Apache license, Version 2.0 > + * (the "License"); you may not use this file except in compliance with > + * the License. You may obtain a copy of the License at > + * > + * http://www.apache.org/licenses/LICENSE-2.0 > + * > + * Unless required by applicable law or agreed to in writing, software > + * distributed under the License is distributed on an "AS IS" BASIS, > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > + * See the license for the specific language governing permissions and > + * limitations under the license. > + */ > +package org.apache.logging.log4j; > + > +/* > + * Copyright 2001-2005 The Apache Software Foundation. > + * > + * Licensed under the Apache License, Version 2.0 (the "License"); > + * you may not use this file except in compliance with the License. > + * You may obtain a copy of the License at > + * > + * http://www.apache.org/licenses/LICENSE-2.0 > + * > + * Unless required by applicable law or agreed to in writing, software > + * distributed under the License is distributed on an "AS IS" BASIS, > + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. > + * See the License for the specific language governing permissions and > + * limitations under the License. > + */ > + > +import java.io.File; > + > +import org.apache.logging.log4j.changelog.releaser.ChangelogReleaser; > +import org.apache.logging.log4j.changelog.releaser.ChangelogReleaserArgs; > + > +import org.apache.maven.plugin.AbstractMojo; > +import org.apache.maven.plugin.MojoExecutionException; > +import org.apache.maven.plugins.annotations.LifecyclePhase; > +import org.apache.maven.plugins.annotations.Mojo; > +import org.apache.maven.plugins.annotations.Parameter; > + > +/** > + * Goal which creates a changelog. > + */ > +@Mojo(name = "release", defaultPhase = LifecyclePhase.PRE_SITE) > +public class ReleaseMojo extends AbstractMojo { > + /** > + * Location of the file. > + */ > + @Parameter(property = "version", required = true) > + private String releaseVersion; > + > + /** > + * Location of the file. > + */ > + @Parameter(defaultValue = "${project.basedir}/src/changelog", property = > "changeLogDir", required = true) > + private File changeLogDirectory; > + > + public void execute() throws MojoExecutionException { > + try { > + > ChangelogReleaser.performRelease(ChangelogReleaserArgs.fromArgs(changeLogDirectory.toPath(), > + releaseVersion)); > + } catch (Exception ex) { > + throw new MojoExecutionException("Error performing release", ex); > + } > + } > +} > diff --git a/pom.xml b/pom.xml > index c7c76fa..5abb06e 100644 > --- a/pom.xml > +++ b/pom.xml > @@ -48,13 +48,13 @@ > > <!-- Modules here must have a corresponding entry in > `dependencyManagement > dependencies` block below! --> > <module>log4j-changelog</module> > - > + <module>log4j-maven-changelog-plugin</module> > </modules> > > <properties> > > <!-- project version --> > - <revision>0.1.0-SNAPSHOT</revision> > + <revision>0.2.0-SNAPSHOT</revision> > > <!-- `minimalJavaBuildVersion` is employed by `org.apache:apache`, which > is the parent of `org.apache.logging:logging-parent`, which is the parent of > us. > `minimalJavaBuildVersion` is used for enforcing the compiler version. >