maven-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mkrizmanic <>
Subject [GitHub] maven pull request: [MNG-5957] Configuration within lifecycle phas...
Date Fri, 22 Jan 2016 11:32:59 GMT
Github user mkrizmanic commented on the pull request:
    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
    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];
            // invalid
            gs = null;
        return gs;
    The configuration regex may contain any character except ‘]' that may be escaped ‘/]'.
    The goals parsing is changed within the LifecyclePhase because it shouldn’t split goals
only using the commas because the commas may be a part of an additional configuration.

If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at or file a JIRA ticket
with INFRA.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message