Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need ability to override GitFlowConfig and CommitMessages via CLI #284

Closed
kutsal opened this issue Mar 14, 2021 · 2 comments
Closed

Need ability to override GitFlowConfig and CommitMessages via CLI #284

kutsal opened this issue Mar 14, 2021 · 2 comments

Comments

@kutsal
Copy link

kutsal commented Mar 14, 2021

Have a particular use-case where (because our CI pipeline is using this plugin indiscriminately across all our Java projects) we need the ability to override the plugin configuration defaults via maven command-line even when the project being built does not reference this plugin. Right now gitFlowConfig cannot be specified via command-line. #263 attempts this, but since it's doing it in constructor, pom files override the configuration, which isn't how it should work with Maven -- command-line overrides pom, not the other way around.

@aleksandr-m
Copy link
Owner

@kutsal

pom files override the configuration, which isn't how it should work with Maven

But it is.

I see what benefit it brings, but I'm not sure that going against Maven way is the best course of action.

@kutsal
Copy link
Author

kutsal commented Mar 16, 2021

@aleksandr-m

see edit history of this comment if you like, but

I guess it becomes against convention if a <configuration>...</configuration> block is provided in the pom. I'd argue that isn't the case in our use-case, but I see your point.

How do you feel about something like this instead:

public void set(String gitFlowConfig) throws IntrospectionException, InvocationTargetException, IllegalAccessException {
    Map<String, String> values = Splitter.on(",").withKeyValueSeparator("=").split(gitFlowConfig);
    for(Entry<String, String> e : values.entrySet()) {
        new PropertyDescriptor(e.getKey(), this.getClass()).getWriteMethod().invoke(this, e.getValue());
    }
}

that allows me to pass -DgitFlowConfig=productionBranch=FOO,origin=BAR via command-line.

This has the advantage of doing it The Maven Way -- via the set(..) method. If pom has a configuration block for the plugin, that takes precedence as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants