Skip to content

Commit

Permalink
Add dummy parameter to prevent warnings with jgit as timestamp provider
Browse files Browse the repository at this point in the history
Maven 3.9 complains of "missing" parameters even if we need them for the
jgit provider.

This adds two dummy parameters so maven is happy again.

Fix #2080

(cherry picked from commit 0ffb59a)
  • Loading branch information
laeubi committed Jul 31, 2023
1 parent 52af49d commit 85a36a9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@
*/
@Component(role = BuildTimestampProvider.class, hint = "jgit")
public class JGitBuildTimestampProvider implements BuildTimestampProvider {
private static final String PARAMETER_JGIT_IGNORE = "jgit.ignore";

private static final String PARAMETER_JGIT_DIRTY_WORKING_TREE = "jgit.dirtyWorkingTree";

@Requirement(hint = "default")
private BuildTimestampProvider defaultTimestampProvider;
Expand All @@ -112,7 +115,7 @@ public static DirtyBehavior getDirtyWorkingTreeBehaviour(MojoExecution execution
if (pluginConfiguration == null) {
return defaultBehaviour;
}
Xpp3Dom dirtyWorkingTreeDom = pluginConfiguration.getChild("jgit.dirtyWorkingTree");
Xpp3Dom dirtyWorkingTreeDom = pluginConfiguration.getChild(PARAMETER_JGIT_DIRTY_WORKING_TREE);
if (dirtyWorkingTreeDom == null) {
return defaultBehaviour;
}
Expand Down Expand Up @@ -219,7 +222,7 @@ private static String getIgnoreFilter(MojoExecution execution) {
if (pluginConfiguration == null) {
return null;
}
Xpp3Dom ignoreDom = pluginConfiguration.getChild("jgit.ignore");
Xpp3Dom ignoreDom = pluginConfiguration.getChild(PARAMETER_JGIT_IGNORE);
if (ignoreDom == null) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,26 @@ public class BuildQualifierMojo extends AbstractVersionMojo {
@Parameter(property = "mojoExecution", readonly = true)
protected MojoExecution execution;

@Component(role = BuildTimestampProvider.class)
protected Map<String, BuildTimestampProvider> timestampProviders;
@Component(role = BuildTimestampProvider.class)
protected Map<String, BuildTimestampProvider> timestampProviders;

@Component
private BuildPropertiesParser buildPropertiesParser;

/**
* This is only a dummy parameter used to prevent maven from complaining about
* "unknown" parameters when using the jgit extension
*/
@Parameter(alias = "jgit.dirtyWorkingTree")
private String dummy1;

/**
* This is only a dummy parameter used to prevent maven from complaining about
* "unknown" parameters when using the jgit extension
*/
@Parameter(alias = "jgit.ignore")
private String dummy2;

// setter is needed to make sure we always use UTC
public void setFormat(String formatString) {
format = new SimpleDateFormat(formatString);
Expand Down

0 comments on commit 85a36a9

Please sign in to comment.