Compare commits

...

No commits in common. 'i8c' and 'i10cs' have entirely different histories.
i8c ... i10cs

@ -0,0 +1,390 @@
From 6959fc7950013a2e94cb30aa008e78f01a03ed63 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
Date: Fri, 9 Feb 2024 21:52:37 +0100
Subject: [PATCH] Port to maven-plugin-annotations from Javadoc tags
---
pom.xml | 6 +
.../maven_replacer_plugin/ReplacerMojo.java | 111 ++++++------------
2 files changed, 43 insertions(+), 74 deletions(-)
diff --git a/pom.xml b/pom.xml
index 9d2de74..4a2efed 100644
--- a/pom.xml
+++ b/pom.xml
@@ -156,6 +156,12 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
<version>3.0.3</version>
<scope>compile</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-annotations</artifactId>
+ <version>3.11.0</version>
+ <scope>provided</scope>
+ </dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
diff --git a/src/main/java/com/google/code/maven_replacer_plugin/ReplacerMojo.java b/src/main/java/com/google/code/maven_replacer_plugin/ReplacerMojo.java
index ac165a9..de4fdc3 100644
--- a/src/main/java/com/google/code/maven_replacer_plugin/ReplacerMojo.java
+++ b/src/main/java/com/google/code/maven_replacer_plugin/ReplacerMojo.java
@@ -14,18 +14,14 @@ import java.util.regex.PatternSyntaxException;
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 replaces token with value inside file
- *
- * @goal replace
- *
- * @phase compile
- *
- * @threadSafe
- *
*/
+@Mojo(name="replace", defaultPhase=LifecyclePhase.COMPILE, threadSafe=true)
public class ReplacerMojo extends AbstractMojo {
private static final String INVALID_IGNORE_MISSING_FILE_MESSAGE = "<ignoreMissingFile> only useable with <file>";
private static final String REGEX_PATTERN_WITH_DELIMITERS_MESSAGE = "Error: %s. " +
@@ -47,27 +43,24 @@ public class ReplacerMojo extends AbstractMojo {
* Path to single file to replace tokens in.
* The file must be text (ascii).
* Based on current execution path.
- *
- * @parameter
*/
+ @Parameter
private String file;
/**
* List of files to include for multiple (or single) replacement.
* In Ant format (*\/directory/**.properties)
* Cannot use with outputFile.
- *
- * @parameter
*/
+ @Parameter
private List<String> includes = new ArrayList<String>();
/**
* List of files to exclude for multiple (or single) replacement.
* In Ant format (*\/directory/**.properties)
* Cannot use with outputFile.
- *
- * @parameter
*/
+ @Parameter
private List<String> excludes = new ArrayList<String>();
/**
@@ -75,9 +68,8 @@ public class ReplacerMojo extends AbstractMojo {
* This is split up and used the same way a array of includes would be.
* In Ant format (*\/directory/**.properties).
* Files not found are ignored by default.
- *
- * @parameter
*/
+ @Parameter
private String filesToInclude;
/**
@@ -85,27 +77,24 @@ public class ReplacerMojo extends AbstractMojo {
* This is split up and used the same way a array of excludes would be.
* In Ant format (**\/directory/do-not-replace.properties).
* The files replaced will be derived from the list of includes and excludes.
- *
- * @parameter
*/
+ @Parameter
private String filesToExclude;
/**
* Token to replace.
* The text to replace within the given file.
* This may or may not be a regular expression (see regex notes above).
- *
- * @parameter
*/
+ @Parameter
private String token;
/**
* Token file containing a token to be replaced in the target file/s.
* May be multiple words or lines.
* This is useful if you do not wish to expose the token within your pom or the token is long.
- *
- * @parameter
*/
+ @Parameter
private String tokenFile;
/**
@@ -113,9 +102,8 @@ public class ReplacerMojo extends AbstractMojo {
* Use only with file configuration (not includes etc).
* Set to true to not fail build if the file is not found.
* First checks if file exists and exits without attempting to replace anything.
- *
- * @parameter
*/
+ @Parameter
private boolean ignoreMissingFile;
/**
@@ -123,26 +111,23 @@ public class ReplacerMojo extends AbstractMojo {
* The text to be written over any found tokens.
* If no value is given, the tokens found are replaced with an empty string (effectively removing any tokens found).
* You can also reference grouped regex matches made in the token here by $1, $2, etc.
- *
- * @parameter
*/
+ @Parameter
private String value;
/**
* A file containing a value to replace the given token with.
* May be multiple words or lines.
* This is useful if you do not wish to expose the value within your pom or the value is long.
- *
- * @parameter
*/
+ @Parameter
private String valueFile;
/**
* Indicates if the token should be located with regular expressions.
* This should be set to false if the token contains regex characters which may miss the desired tokens or even replace the wrong tokens.
- *
- * @parameter
*/
+ @Parameter
private boolean regex = true;
/**
@@ -151,18 +136,16 @@ public class ReplacerMojo extends AbstractMojo {
* The path and file are created if it does not exist.
* If it does exist, the contents are overwritten.
* You should not use outputFile when using a list of includes.
- *
- * @parameter
*/
+ @Parameter
private String outputFile;
/**
* Output to another dir.
* Destination directory relative to the execution directory for all replaced files to be written to.
* Use with outputDir to have files written to a specific base location.
- *
- * @parameter
*/
+ @Parameter
private String outputDir;
/**
@@ -171,9 +154,8 @@ public class ReplacerMojo extends AbstractMojo {
* This file may contain multiple entries to support a single file containing different tokens to have replaced.
* Each token/value pair should be in the format: "token=value" (without quotations).
* If your token contains ='s you must escape the = character to \=. e.g. tok\=en=value
- *
- * @parameter
*/
+ @Parameter
private String tokenValueMap;
/**
@@ -181,9 +163,8 @@ public class ReplacerMojo extends AbstractMojo {
* Path to base relative files for replacements from.
* This feature is useful for multi-module projects.
* Default "." which is the default Maven basedir.
- *
- * @parameter default-value="."
*/
+ @Parameter(defaultValue = ".")
private String basedir = ".";
/**
@@ -197,18 +178,16 @@ public class ReplacerMojo extends AbstractMojo {
* * MULTILINE
* * UNICODE_CASE
* * UNIX_LINES
- *
- * @parameter
*/
+ @Parameter
private List<String> regexFlags;
/**
* List of replacements with token/value pairs.
* Each replacement element to contain sub-elements as token/value pairs.
* Each token within the given file will be replaced by it's respective value.
- *
- * @parameter
*/
+ @Parameter
private List<Replacement> replacements;
/**
@@ -216,52 +195,46 @@ public class ReplacerMojo extends AbstractMojo {
* Comment lines start with '#'.
* If your token starts with an '#' then you must supply the commentsEnabled parameter and with a value of false.
* Default is true.
- *
- * @parameter default-value="true"
*/
+ @Parameter(defaultValue = "true")
private boolean commentsEnabled = true;
/**
* Skip running this plugin.
* Default is false.
- *
- * @parameter default-value="false"
*/
+ @Parameter(defaultValue = "false")
private boolean skip = false;
/**
* Base directory (appended) to use for outputDir.
* Having this existing but blank will cause the outputDir
* to be based on the execution directory.
- *
- * @parameter
*/
+ @Parameter
private String outputBasedir;
/**
* Parent directory is preserved when replacing files found from includes and
* being written to an outputDir.
* Default is true.
- *
- * @parameter default-value="true"
*/
+ @Parameter(defaultValue = "true")
private boolean preserveDir = true;
/**
* Stops printing a summary of files that have had replacements performed upon them when true.
* Default is false.
- *
- * @parameter default-value="false"
*/
+ @Parameter(defaultValue = "false")
private boolean quiet = false;
/**
* Unescape tokens and values to Java format.
* e.g. token\n is unescaped to token(carriage return).
* Default is false.
- *
- * @parameter default-value="false"
*/
+ @Parameter(defaultValue = "false")
private boolean unescape;
/**
@@ -269,9 +242,8 @@ public class ReplacerMojo extends AbstractMojo {
* You may also use the '' character to place the token in the desired location for matching.
* e.g. @ would match @token@.
* e.g. ${} would match ${token}.
- *
- * @parameter
*/
+ @Parameter
private List<String> delimiters = new ArrayList<String>();
/**
@@ -280,9 +252,8 @@ public class ReplacerMojo extends AbstractMojo {
* This parameter may contain multiple entries to support a single file containing different tokens to have replaced.
* Format is comma separated. e.g. token=value,token2=value2
* Comments are not supported.
- *
- * @parameter
*/
+ @Parameter
private String variableTokenValueMap;
/**
@@ -293,34 +264,30 @@ public class ReplacerMojo extends AbstractMojo {
* Only usable with file parameter.
*
* Default is false.
- *
- * @parameter default-value="false"
*/
+ @Parameter(defaultValue = "false")
private boolean ignoreErrors;
/**
* X-Path expression for locating node's whose content you wish to replace.
* This is useful if you have the same token appearing in many nodes but
* wish to only replace the contents of one or more of them.
- *
- * @parameter
*/
+ @Parameter
private String xpath;
/**
* File encoding used when reading and writing files.
* Default system encoding used when not specified.
- *
- * @parameter default-value="${project.build.sourceEncoding}"
*/
+ @Parameter(defaultValue = "${project.build.sourceEncoding}")
private String encoding;
/**
* Regular expression is run on an input file's name to create the output file with.
* Must be used in conjunction with outputFilePattern.
- *
- * @parameter
*/
+ @Parameter
private String inputFilePattern;
/**
@@ -328,30 +295,26 @@ public class ReplacerMojo extends AbstractMojo {
* Must be used in conjunction with inputFilePattern.
*
* The parameter outputFile is ignored when outputFilePattern is used.
- *
- * @parameter
*/
+ @Parameter
private String outputFilePattern;
/**
* Set a maximum number of files which can be replaced per execution.
- *
- * @parameter
*/
+ @Parameter
private Integer maxReplacements = Integer.MAX_VALUE;
/**
* list files
- *
- * @parameter
*/
+ @Parameter
private List<String> files = new ArrayList<String>();
/**
* list out put file
- *
- * @parameter
*/
+ @Parameter
private List<String> outputFiles = new ArrayList<String>();
public ReplacerMojo() {
--
2.41.0

@ -1,26 +1,24 @@
Name: replacer Name: replacer
Version: 1.6 Version: 1.6
Release: 6%{?dist} Release: 32%{?dist}
Summary: Replacer Maven Mojo Summary: Replacer Maven Mojo
License: MIT License: MIT
URL: https://github.com/beiliubei/maven-replacer-plugin URL: https://github.com/beiliubei/maven-replacer-plugin
# http://code.google.com/p/maven-replacer-plugin/ # http://code.google.com/p/maven-replacer-plugin/
Source0: https://github.com/beiliubei/maven-replacer-plugin/archive/%{version}.tar.gz Source0: https://github.com/beiliubei/maven-replacer-plugin/archive/%{version}.tar.gz
Patch0: 0001-Port-to-maven-plugin-annotations-from-Javadoc-tags.patch
BuildRequires: maven-local BuildRequires: maven-local
BuildRequires: mvn(commons-io:commons-io) BuildRequires: mvn(commons-io:commons-io)
BuildRequires: mvn(commons-lang:commons-lang)
BuildRequires: mvn(junit:junit)
BuildRequires: mvn(org.apache.ant:ant) BuildRequires: mvn(org.apache.ant:ant)
BuildRequires: mvn(org.apache.commons:commons-lang3)
BuildRequires: mvn(org.apache.maven:maven-plugin-api) BuildRequires: mvn(org.apache.maven:maven-plugin-api)
BuildRequires: mvn(org.apache.maven.plugin-tools:maven-plugin-annotations)
BuildRequires: mvn(org.apache.maven.plugins:maven-plugin-plugin) BuildRequires: mvn(org.apache.maven.plugins:maven-plugin-plugin)
BuildRequires: mvn(org.hamcrest:hamcrest-all)
BuildRequires: mvn(org.mockito:mockito-all)
BuildRequires: mvn(org.sonatype.oss:oss-parent:pom:)
BuildRequires: mvn(xerces:xercesImpl) BuildRequires: mvn(xerces:xercesImpl)
BuildRequires: mvn(xml-apis:xml-apis)
BuildArch: noarch BuildArch: noarch
ExclusiveArch: %{java_arches} noarch
%description %description
Maven plugin to replace tokens in a given file with a value. Maven plugin to replace tokens in a given file with a value.
@ -36,20 +34,33 @@ This package contains javadoc for %{name}.
%prep %prep
%setup -q -n maven-replacer-plugin-%{version} %setup -q -n maven-replacer-plugin-%{version}
%patch 0 -p1
# remove unnecessary dependency on parent POM
%pom_remove_parent
%pom_remove_plugin :dashboard-maven-plugin %pom_remove_plugin :dashboard-maven-plugin
%pom_remove_plugin :maven-assembly-plugin %pom_remove_plugin :maven-assembly-plugin
# NoClassDefFoundError: org/w3c/dom/ElementTraversal
%pom_add_dep xml-apis:xml-apis::test
sed -i.hamcrest '/startsWith/d' src/test/java/com/google/code/maven_replacer_plugin/file/FileUtilsTest.java # remove hard-coded compiler settings
%pom_remove_plugin :maven-compiler-plugin
# trivial port to commons-lang3
%pom_change_dep :commons-lang org.apache.commons:commons-lang3:3.8.1
# "No mojo definitions were found for plugin" with maven-plugin-plugin 3.9
%pom_xpath_inject "pom:build/pom:plugins/pom:plugin[pom:artifactId='maven-plugin-plugin']" \
'<configuration><skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound></configuration>'
for i in $(find -name "*.java"); do
sed -i "s/org.apache.commons.lang./org.apache.commons.lang3./g" $i;
done
%mvn_file :%{name} %{name} %mvn_file :%{name} %{name}
%mvn_alias :%{name} com.google.code.maven-replacer-plugin:maven-replacer-plugin %mvn_alias :%{name} com.google.code.maven-replacer-plugin:maven-replacer-plugin
%build %build
%mvn_build -f -- -Dmaven.compiler.source=1.8 -Dmaven.compiler.target=1.8
%mvn_build
%install %install
%mvn_install %mvn_install
@ -62,8 +73,87 @@ sed -i.hamcrest '/startsWith/d' src/test/java/com/google/code/maven_replacer_plu
%license LICENSE %license LICENSE
%changelog %changelog
* Thu May 09 2024 Arkady L. Shane <tigro@msvsphere-os.ru> - 1.6-6 * Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1.6-32
- Rebuilt for MSVSphere 8.9 - Bump release for October 2024 mass rebuild:
Resolves: RHEL-64018
* Fri Oct 25 2024 MSVSphere Packaging Team <packager@msvsphere-os.ru> - 1.6-31
- Rebuilt for MSVSphere 10
* Fri Aug 09 2024 Marián Konček <mkoncek@redhat.com> - 1.6-31
- Rebuild without generated Requires
* Mon Jun 24 2024 Troy Dawson <tdawson@redhat.com> - 1.6-30
- Bump release for June 2024 mass rebuild
* Fri Feb 09 2024 Mikolaj Izdebski <mizdebsk@redhat.com> - 1.6-29
- Port to maven-plugin-annotations from Javadoc tags
* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-28
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-27
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-26
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild
* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-25
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
* Sat Jul 23 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-24
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
* Fri Jul 08 2022 Jiri Vanek <jvanek@redhat.com> - 1.6-23
- Rebuilt for Drop i686 JDKs
* Sat Feb 05 2022 Jiri Vanek <jvanek@redhat.com> - 1.6-22
- Rebuilt for java-17-openjdk as system jdk
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-21
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Wed May 12 2021 Ondrej Dubaj <odubaj@redhat.com> - 1.6-19
- Remove maven-javadoc-plugin dependency
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-18
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Thu Jul 30 2020 Fabio Valentini <decathorpe@gmail.com> - 1.6-17
- Port to commons-lang3.
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-16
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Sat Jul 11 2020 Jiri Vanek <jvanek@redhat.com> - 1.6-15
- Rebuilt for JDK-11, see https://fedoraproject.org/wiki/Changes/Java11
* Fri Jun 26 2020 Mat Booth <mat.booth@redhat.com> - 1.6-14
- Allow building against Java 11
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Fri Nov 22 2019 Fabio Valentini <decathorpe@gmail.com> - 1.6-12
- Remove unnecessary dependency on parent POM.
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Thu Apr 18 2019 Mat Booth <mat.booth@redhat.com> - 1.6-10
- Disable tests to reduce dependency tree
* Wed Feb 13 2019 Mat Booth <mat.booth@redhat.com> - 1.6-9
- Fix build against mockito 2.x
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-6 * Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.6-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

Loading…
Cancel
Save