[MNG-5957] Configuration within lifecycle phase#76
[MNG-5957] Configuration within lifecycle phase#76mkrizmanic wants to merge 1 commit intoapache:masterfrom mkrizmanic:mng-5957
Conversation
|
Maybe the change seems to be a bit complicated but it really isn't. The current version splits goals using comma as the separator String[] mojoGoals = StringUtils.split( goals, "," );while the pull request uses the regular expression that matches the goals (similar as the current version) and optional additional configurations: String goalRegex = "(?<goal>[^:\\[,\\s]+(?::[^:\\[,\\s]+)\{2,3\})";
// match [<configuration>]
String configurationRegex = "(?:\\[(?<configuration>(?:[^\\]]|(?:(?<=/)\\]))*)\\])?";
Pattern pattern = Pattern.compile( goalRegex + configurationRegex );
Matcher matcher = pattern.matcher( goals );The goal may be compounded from 3 or 4 non-whitespace and non-comma character arrays delimited with colon - because the DefaultLifecyclePluginAnalyzer class requires them in parseGoalSpec method: private GoalSpec parseGoalSpec( String goalSpec )
{
GoalSpec gs = new GoalSpec();
String[] p = StringUtils.split( goalSpec.trim(), ":" );
if ( p.length == 3 )
{
// <groupId>:<artifactId>:<goal>
gs.groupId = p[0];
gs.artifactId = p[1];
gs.goal = p[2];
}
else if ( p.length == 4 )
{
// <groupId>:<artifactId>:<version>:<goal>
gs.groupId = p[0];
gs.artifactId = p[1];
gs.version = p[2];
gs.goal = p[3];
}
else
{
// invalid
gs = null;
}
return gs;
}The configuration regex may contain any character except ‘]' that may be escaped ‘/]'. |
|
This was actually implemented in MNG-5805 [1]. |
|
Thanks. It works like a charm. |
|
I didn't get to using it yet after implementing, cool that it works for someone :) |
|
@atanasenko do you have any other open issues regarding MNG-5805? I had one that had been fixed: MNG-6127 |
|
Resolve #7733 |
The lifecycle phase can be configured as a comma-separated list of plugins specified with the following data:
that are not enough for my plugin.
My plugin has to reconfigure the default lifecycle using other plugins with dedicated configuration different from their defaults'.
So, I'd suppose to enhance the lifecycle phase parsing to support additional configuration as:
Finally, the components.xml would support configurations like: