This is an automated email from the ASF dual-hosted git repository.

rfscholte pushed a commit to branch drop-cli
in repository https://gitbox.apache.org/repos/asf/maven-wrapper.git

commit b1749640a83d3ba7e6c61a1daf6527719560e0fe
Author: rfscholte <[email protected]>
AuthorDate: Sat Dec 11 13:02:05 2021 +0100

    Remove unnecessary cli code
---
 .../org/apache/maven/wrapper/MavenWrapperMain.java |  32 -
 .../maven/wrapper/SystemPropertiesHandler.java     |  77 ---
 .../wrapper/cli/AbstractCommandLineConverter.java  |  53 --
 .../AbstractPropertiesCommandLineConverter.java    |  66 --
 .../wrapper/cli/CommandLineArgumentException.java  |  39 --
 .../maven/wrapper/cli/CommandLineConverter.java    |  41 --
 .../maven/wrapper/cli/CommandLineOption.java       | 139 -----
 .../maven/wrapper/cli/CommandLineParser.java       | 675 ---------------------
 .../maven/wrapper/cli/ParsedCommandLine.java       | 140 -----
 .../maven/wrapper/cli/ParsedCommandLineOption.java |  59 --
 .../cli/ProjectPropertiesCommandLineConverter.java |  46 --
 .../cli/SystemPropertiesCommandLineConverter.java  |  46 --
 .../maven/wrapper/SystemPropertiesHandlerTest.java |  71 ---
 13 files changed, 1484 deletions(-)

diff --git 
a/maven-wrapper/src/main/java/org/apache/maven/wrapper/MavenWrapperMain.java 
b/maven-wrapper/src/main/java/org/apache/maven/wrapper/MavenWrapperMain.java
index ea5a1d7..e7a9601 100644
--- a/maven-wrapper/src/main/java/org/apache/maven/wrapper/MavenWrapperMain.java
+++ b/maven-wrapper/src/main/java/org/apache/maven/wrapper/MavenWrapperMain.java
@@ -23,12 +23,8 @@ import java.io.File;
 import java.io.InputStream;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.util.Map;
 import java.util.Properties;
 
-import org.apache.maven.wrapper.cli.CommandLineParser;
-import org.apache.maven.wrapper.cli.SystemPropertiesCommandLineConverter;
-
 /**
  * Main entry point for the Maven Wrapper, delegating wrapper execution to 
{@link WrapperExecutor}.
  *
@@ -58,44 +54,16 @@ public class MavenWrapperMain
     {
         File wrapperJar = wrapperJar();
         File propertiesFile = wrapperProperties( wrapperJar );
-        File rootDir = rootDir( wrapperJar );
 
         String wrapperVersion = wrapperVersion();
         Logger.info( "Apache Maven Wrapper " + wrapperVersion );
 
-        Properties systemProperties = System.getProperties();
-        systemProperties.putAll( parseSystemPropertiesFromArgs( args ) );
-
-        addSystemProperties( rootDir );
-
         WrapperExecutor wrapperExecutor = 
WrapperExecutor.forWrapperPropertiesFile( propertiesFile, System.out );
         wrapperExecutor.execute( args, new Installer( new DefaultDownloader( 
"mvnw", wrapperVersion ),
                                                       new PathAssembler( 
mavenUserHome() ) ),
                                  new BootstrapMainStarter() );
     }
 
-    private static Map<String, String> parseSystemPropertiesFromArgs( String[] 
args )
-    {
-        SystemPropertiesCommandLineConverter converter = new 
SystemPropertiesCommandLineConverter();
-        CommandLineParser commandLineParser = new CommandLineParser();
-        converter.configure( commandLineParser );
-        commandLineParser.allowUnknownOptions();
-        return converter.convert( commandLineParser.parse( args ) );
-    }
-
-    private static void addSystemProperties( File rootDir )
-    {
-        System.getProperties().putAll( 
SystemPropertiesHandler.getSystemProperties( new File( mavenUserHome(),
-                                                                               
               "maven.properties" ) ) );
-        System.getProperties().putAll( 
SystemPropertiesHandler.getSystemProperties( new File( rootDir,
-                                                                               
               "maven.properties" ) ) );
-    }
-
-    private static File rootDir( File wrapperJar )
-    {
-        return wrapperJar.getParentFile().getParentFile().getParentFile();
-    }
-
     private static File wrapperProperties( File wrapperJar )
     {
         return new File( wrapperJar.getParent(), 
wrapperJar.getName().replaceFirst( "\\.jar$", ".properties" ) );
diff --git 
a/maven-wrapper/src/main/java/org/apache/maven/wrapper/SystemPropertiesHandler.java
 
b/maven-wrapper/src/main/java/org/apache/maven/wrapper/SystemPropertiesHandler.java
deleted file mode 100644
index ac45478..0000000
--- 
a/maven-wrapper/src/main/java/org/apache/maven/wrapper/SystemPropertiesHandler.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.apache.maven.wrapper;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * @author Hans Dockter
- */
-public class SystemPropertiesHandler
-{
-
-    public static Map<String, String> getSystemProperties( File propertiesFile 
)
-    {
-        Map<String, String> propertyMap = new HashMap<String, String>();
-        if ( !propertiesFile.isFile() )
-        {
-            return propertyMap;
-        }
-        Properties properties = new Properties();
-        try
-        {
-            FileInputStream inStream = new FileInputStream( propertiesFile );
-            try
-            {
-                properties.load( inStream );
-            }
-            finally
-            {
-                inStream.close();
-            }
-        }
-        catch ( IOException e )
-        {
-            throw new RuntimeException( "Error when loading properties file=" 
+ propertiesFile, e );
-        }
-
-        Pattern pattern = Pattern.compile( "systemProp\\.(.*)" );
-        for ( Object argument : properties.keySet() )
-        {
-            Matcher matcher = pattern.matcher( argument.toString() );
-            if ( matcher.find() )
-            {
-                String key = matcher.group( 1 );
-                if ( key.length() > 0 )
-                {
-                    propertyMap.put( key, properties.get( argument 
).toString() );
-                }
-            }
-        }
-        return propertyMap;
-    }
-}
diff --git 
a/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/AbstractCommandLineConverter.java
 
b/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/AbstractCommandLineConverter.java
deleted file mode 100644
index 9ad5b3c..0000000
--- 
a/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/AbstractCommandLineConverter.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.apache.maven.wrapper.cli;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Command line converter.
- *
- * @param <T> type
- */
-public abstract class AbstractCommandLineConverter<T>
-    implements CommandLineConverter<T>
-{
-    public T convert( Iterable<String> args )
-        throws CommandLineArgumentException
-    {
-        CommandLineParser parser = new CommandLineParser();
-        configure( parser );
-        return convert( parser.parse( args ) );
-    }
-
-    public T convert( ParsedCommandLine args )
-        throws CommandLineArgumentException
-    {
-        return convert( args, newInstance() );
-    }
-
-    public T convert( Iterable<String> args, T target )
-        throws CommandLineArgumentException
-    {
-        CommandLineParser parser = new CommandLineParser();
-        configure( parser );
-        return convert( parser.parse( args ), target );
-    }
-
-    protected abstract T newInstance();
-}
diff --git 
a/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/AbstractPropertiesCommandLineConverter.java
 
b/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/AbstractPropertiesCommandLineConverter.java
deleted file mode 100644
index fee974c..0000000
--- 
a/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/AbstractPropertiesCommandLineConverter.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.apache.maven.wrapper.cli;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Converter form properties.
- */
-public abstract class AbstractPropertiesCommandLineConverter
-    extends AbstractCommandLineConverter<Map<String, String>>
-{
-    protected abstract String getPropertyOption();
-
-    protected abstract String getPropertyOptionDetailed();
-
-    protected abstract String getPropertyOptionDescription();
-
-    public void configure( CommandLineParser parser )
-    {
-        CommandLineOption option = parser.option( getPropertyOption(), 
getPropertyOptionDetailed() );
-        option = option.hasArguments();
-        option.hasDescription( getPropertyOptionDescription() );
-    }
-
-    protected Map<String, String> newInstance()
-    {
-        return new HashMap<String, String>();
-    }
-
-    public Map<String, String> convert( ParsedCommandLine options, Map<String, 
String> properties )
-        throws CommandLineArgumentException
-    {
-        for ( String keyValueExpression : options.option( getPropertyOption() 
).getValues() )
-        {
-            int pos = keyValueExpression.indexOf( "=" );
-            if ( pos < 0 )
-            {
-                properties.put( keyValueExpression, "" );
-            }
-            else
-            {
-                properties.put( keyValueExpression.substring( 0, pos ), 
keyValueExpression.substring( pos + 1 ) );
-            }
-        }
-        return properties;
-    }
-}
diff --git 
a/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/CommandLineArgumentException.java
 
b/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/CommandLineArgumentException.java
deleted file mode 100644
index 588b6f5..0000000
--- 
a/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/CommandLineArgumentException.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.apache.maven.wrapper.cli;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * A {@code CommandLineArgumentException} is thrown when command-line 
arguments cannot be parsed.
- * 
- * @author Hans Dockter
- */
-public class CommandLineArgumentException
-    extends RuntimeException
-{
-    public CommandLineArgumentException( String message )
-    {
-        super( message );
-    }
-
-    public CommandLineArgumentException( String message, Throwable cause )
-    {
-        super( message, cause );
-    }
-}
diff --git 
a/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/CommandLineConverter.java
 
b/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/CommandLineConverter.java
deleted file mode 100644
index f863901..0000000
--- 
a/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/CommandLineConverter.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.apache.maven.wrapper.cli;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * @author Hans Dockter
- * @param <T> type
- */
-public interface CommandLineConverter<T>
-{
-    T convert( Iterable<String> args )
-        throws CommandLineArgumentException;
-
-    T convert( Iterable<String> args, T target )
-        throws CommandLineArgumentException;
-
-    T convert( ParsedCommandLine args )
-        throws CommandLineArgumentException;
-
-    T convert( ParsedCommandLine args, T target )
-        throws CommandLineArgumentException;
-
-    void configure( CommandLineParser parser );
-}
diff --git 
a/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/CommandLineOption.java
 
b/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/CommandLineOption.java
deleted file mode 100644
index ededc45..0000000
--- 
a/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/CommandLineOption.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package org.apache.maven.wrapper.cli;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Command line option. 
- */
-public class CommandLineOption
-{
-    private final Set<String> options = new HashSet<String>();
-
-    private Class<?> argumentType = Void.TYPE;
-
-    private String description;
-
-    private String subcommand;
-
-    private String deprecationWarning;
-
-    private boolean incubating;
-
-    public CommandLineOption( Iterable<String> options )
-    {
-        for ( String option : options )
-        {
-            this.options.add( option );
-        }
-    }
-
-    public Set<String> getOptions()
-    {
-        return options;
-    }
-
-    public CommandLineOption hasArgument()
-    {
-        argumentType = String.class;
-        return this;
-    }
-
-    public CommandLineOption hasArguments()
-    {
-        argumentType = List.class;
-        return this;
-    }
-
-    public String getSubcommand()
-    {
-        return subcommand;
-    }
-
-    public CommandLineOption mapsToSubcommand( String command )
-    {
-        this.subcommand = command;
-        return this;
-    }
-
-    public String getDescription()
-    {
-        StringBuilder result = new StringBuilder();
-        if ( description != null )
-        {
-            result.append( description );
-        }
-        if ( deprecationWarning != null )
-        {
-            if ( result.length() > 0 )
-            {
-                result.append( ' ' );
-            }
-            result.append( "[deprecated - " );
-            result.append( deprecationWarning );
-            result.append( "]" );
-        }
-        if ( incubating )
-        {
-            if ( result.length() > 0 )
-            {
-                result.append( ' ' );
-            }
-            result.append( "[incubating]" );
-        }
-        return result.toString();
-    }
-
-    public CommandLineOption hasDescription( String description )
-    {
-        this.description = description;
-        return this;
-    }
-
-    public boolean getAllowsArguments()
-    {
-        return argumentType != Void.TYPE;
-    }
-
-    public boolean getAllowsMultipleArguments()
-    {
-        return argumentType == List.class;
-    }
-
-    public CommandLineOption deprecated( String deprecationWarning )
-    {
-        this.deprecationWarning = deprecationWarning;
-        return this;
-    }
-
-    public CommandLineOption incubating()
-    {
-        incubating = true;
-        return this;
-    }
-
-    public String getDeprecationWarning()
-    {
-        return deprecationWarning;
-    }
-}
diff --git 
a/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/CommandLineParser.java
 
b/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/CommandLineParser.java
deleted file mode 100644
index c2853ad..0000000
--- 
a/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/CommandLineParser.java
+++ /dev/null
@@ -1,675 +0,0 @@
-package org.apache.maven.wrapper.cli;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Formatter;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
-/**
- * <p>
- * A command-line parser which supports a command/sub-command style 
command-line interface. Supports the following
- * syntax:
- * </p>
- * 
- * <pre>
- * &lt;option&gt;* (&lt;sub-command&gt; &lt;sub-command-option&gt;*)*
- * </pre>
- * <ul>
- * <li>Short options are a '-' followed by a single character. For example: 
{@code -a}.</li>
- * <li>Long options are '--' followed by multiple characters. For example: 
{@code --long-option}.</li>
- * <li>Options can take arguments. The argument follows the option. For 
example: {@code -a arg} or
- * {@code --long arg}.</li>
- * <li>Arguments can be attached to the option using '='. For example: {@code 
-a=arg} or {@code --long=arg}.</li>
- * <li>Arguments can be attached to short options. For example: {@code 
-aarg}.</li>
- * <li>Short options can be combined. For example {@code -ab} is equivalent to 
{@code -a -b}.</li>
- * <li>Anything else is treated as an extra argument. This includes a single 
{@code -} character.</li>
- * <li>'--' indicates the end of the options. Anything following is not parsed 
and is treated as extra arguments.</li>
- * <li>The parser is forgiving, and allows '--' to be used with short options 
and '-' to be used with long options.</li>
- * <li>The set of options must be known at parse time. Sub-commands and their 
options do not need to be known at parse
- * time. Use {@link ParsedCommandLine#getExtraArguments()} to obtain the 
non-option command-line arguments.</li>
- * </ul>
- */
-public class CommandLineParser
-{
-    private Map<String, CommandLineOption> optionsByString = new 
HashMap<String, CommandLineOption>();
-
-    private boolean allowMixedOptions;
-
-    private boolean allowUnknownOptions;
-
-    private final PrintWriter deprecationPrinter;
-
-    public CommandLineParser()
-    {
-        this( new OutputStreamWriter( System.out ) );
-    }
-
-    public CommandLineParser( Writer deprecationPrinter )
-    {
-        this.deprecationPrinter = new PrintWriter( deprecationPrinter );
-    }
-
-    /**
-     * Parses the given command-line.
-     * 
-     * @param commandLine The command-line.
-     * @return The parsed command line.
-     * @throws org.apache.maven.wrapper.cli.CommandLineArgumentException On 
parse failure.
-     */
-    public ParsedCommandLine parse( String... commandLine )
-        throws CommandLineArgumentException
-    {
-        return parse( Arrays.asList( commandLine ) );
-    }
-
-    /**
-     * Parses the given command-line.
-     * 
-     * @param commandLine The command-line.
-     * @return The parsed command line.
-     * @throws org.apache.maven.wrapper.cli.CommandLineArgumentException On 
parse failure.
-     */
-    public ParsedCommandLine parse( Iterable<String> commandLine )
-        throws CommandLineArgumentException
-    {
-        ParsedCommandLine parsedCommandLine =
-            new ParsedCommandLine( new HashSet<CommandLineOption>( 
optionsByString.values() ) );
-        ParserState parseState = new BeforeFirstSubCommand( parsedCommandLine 
);
-        for ( String arg : commandLine )
-        {
-            if ( parseState.maybeStartOption( arg ) )
-            {
-                if ( arg.equals( "--" ) )
-                {
-                    parseState = new AfterOptions( parsedCommandLine );
-                }
-                else if ( arg.matches( "--[^=]+" ) )
-                {
-                    OptionParserState parsedOption = parseState.onStartOption( 
arg, arg.substring( 2 ) );
-                    parseState = parsedOption.onStartNextArg();
-                }
-                else if ( arg.matches( "--[^=]+=.*" ) )
-                {
-                    int endArg = arg.indexOf( '=' );
-                    OptionParserState parsedOption = parseState.onStartOption( 
arg, arg.substring( 2, endArg ) );
-                    parseState = parsedOption.onArgument( arg.substring( 
endArg + 1 ) );
-                }
-                else if ( arg.matches( "-[^=]=.*" ) )
-                {
-                    OptionParserState parsedOption = parseState.onStartOption( 
arg, arg.substring( 1, 2 ) );
-                    parseState = parsedOption.onArgument( arg.substring( 3 ) );
-                }
-                else
-                {
-                    assert arg.matches( "-[^-].*" );
-                    String option = arg.substring( 1 );
-                    if ( optionsByString.containsKey( option ) )
-                    {
-                        OptionParserState parsedOption = 
parseState.onStartOption( arg, option );
-                        parseState = parsedOption.onStartNextArg();
-                    }
-                    else
-                    {
-                        String option1 = arg.substring( 1, 2 );
-                        OptionParserState parsedOption;
-                        if ( optionsByString.containsKey( option1 ) )
-                        {
-                            parsedOption = parseState.onStartOption( "-" + 
option1, option1 );
-                            if ( parsedOption.getHasArgument() )
-                            {
-                                parseState = parsedOption.onArgument( 
arg.substring( 2 ) );
-                            }
-                            else
-                            {
-                                parseState = parsedOption.onComplete();
-                                for ( int i = 2; i < arg.length(); i++ )
-                                {
-                                    String optionStr = arg.substring( i, i + 1 
);
-                                    parsedOption = parseState.onStartOption( 
"-" + optionStr, optionStr );
-                                    parseState = parsedOption.onComplete();
-                                }
-                            }
-                        }
-                        else
-                        {
-                            if ( allowUnknownOptions )
-                            {
-                                // if we are allowing unknowns, just pass 
through the whole arg
-                                parsedOption = parseState.onStartOption( arg, 
option );
-                                parseState = parsedOption.onComplete();
-                            }
-                            else
-                            {
-                                // We are going to throw a 
CommandLineArgumentException below, but want the message
-                                // to reflect that we didn't recognise the 
first char (i.e. the option specifier)
-                                parsedOption = parseState.onStartOption( "-" + 
option1, option1 );
-                                parseState = parsedOption.onComplete();
-                            }
-                        }
-                    }
-                }
-            }
-            else
-            {
-                parseState = parseState.onNonOption( arg );
-            }
-        }
-
-        parseState.onCommandLineEnd();
-        return parsedCommandLine;
-    }
-
-    public CommandLineParser allowMixedSubcommandsAndOptions()
-    {
-        allowMixedOptions = true;
-        return this;
-    }
-
-    public CommandLineParser allowUnknownOptions()
-    {
-        allowUnknownOptions = true;
-        return this;
-    }
-
-    /**
-     * Prints a usage message to the given stream.
-     * 
-     * @param out The output stream to write to.
-     */
-    public void printUsage( Appendable out )
-    {
-        Formatter formatter = new Formatter( out );
-        Set<CommandLineOption> orderedOptions = new 
TreeSet<CommandLineOption>( new OptionComparator() );
-        orderedOptions.addAll( optionsByString.values() );
-        Map<String, String> lines = new LinkedHashMap<String, String>();
-        for ( CommandLineOption option : orderedOptions )
-        {
-            Set<String> orderedOptionStrings = new TreeSet<String>( new 
OptionStringComparator() );
-            orderedOptionStrings.addAll( option.getOptions() );
-            List<String> prefixedStrings = new ArrayList<String>();
-            for ( String optionString : orderedOptionStrings )
-            {
-                if ( optionString.length() == 1 )
-                {
-                    prefixedStrings.add( "-" + optionString );
-                }
-                else
-                {
-                    prefixedStrings.add( "--" + optionString );
-                }
-            }
-
-            String key = join( prefixedStrings, ", " );
-            String value = option.getDescription();
-            if ( value == null || value.length() == 0 )
-            {
-                value = "";
-            }
-
-            lines.put( key, value );
-        }
-        int max = 0;
-        for ( String optionStr : lines.keySet() )
-        {
-            max = Math.max( max, optionStr.length() );
-        }
-        for ( Map.Entry<String, String> entry : lines.entrySet() )
-        {
-            if ( entry.getValue().length() == 0 )
-            {
-                formatter.format( "%s%n", entry.getKey() );
-            }
-            else
-            {
-                formatter.format( "%-" + max + "s  %s%n", entry.getKey(), 
entry.getValue() );
-            }
-        }
-        formatter.flush();
-    }
-
-    private static String join( Collection<?> things, String separator )
-    {
-        StringBuffer buffer = new StringBuffer();
-        boolean first = true;
-
-        if ( separator == null )
-        {
-            separator = "";
-        }
-
-        for ( Object thing : things )
-        {
-            if ( !first )
-            {
-                buffer.append( separator );
-            }
-            buffer.append( thing.toString() );
-            first = false;
-        }
-        return buffer.toString();
-    }
-
-    /**
-     * Defines a new option. By default, the option takes no arguments and has 
no description.
-     * 
-     * @param options The options values.
-     * @return The option, which can be further configured.
-     */
-    public CommandLineOption option( String... options )
-    {
-        for ( String option : options )
-        {
-            if ( optionsByString.containsKey( option ) )
-            {
-                throw new IllegalArgumentException( String.format( "Option 
'%s' is already defined.", option ) );
-            }
-            if ( option.startsWith( "-" ) )
-            {
-                throw new IllegalArgumentException( String.format( "Cannot add 
option '%s' as an option cannot"
-                    + " start with '-'.", option ) );
-            }
-        }
-        CommandLineOption option = new CommandLineOption( Arrays.asList( 
options ) );
-        for ( String optionStr : option.getOptions() )
-        {
-            this.optionsByString.put( optionStr, option );
-        }
-        return option;
-    }
-
-    private static class OptionString
-    {
-        private final String arg;
-
-        private final String option;
-
-        private OptionString( String arg, String option )
-        {
-            this.arg = arg;
-            this.option = option;
-        }
-
-        public String getDisplayName()
-        {
-            return arg.startsWith( "--" ) ? "--" + option : "-" + option;
-        }
-
-        @Override
-        public String toString()
-        {
-            return getDisplayName();
-        }
-    }
-
-    private abstract static class ParserState
-    {
-        public abstract boolean maybeStartOption( String arg );
-
-        boolean isOption( String arg )
-        {
-            return arg.matches( "-.+" );
-        }
-
-        public abstract OptionParserState onStartOption( String arg, String 
option );
-
-        public abstract ParserState onNonOption( String arg );
-
-        public void onCommandLineEnd()
-        {
-        }
-    }
-
-    private abstract class OptionAwareParserState
-        extends ParserState
-    {
-        protected final ParsedCommandLine commandLine;
-
-        protected OptionAwareParserState( ParsedCommandLine commandLine )
-        {
-            this.commandLine = commandLine;
-        }
-
-        @Override
-        public boolean maybeStartOption( String arg )
-        {
-            return isOption( arg );
-        }
-
-        @Override
-        public ParserState onNonOption( String arg )
-        {
-            commandLine.addExtraValue( arg );
-            return allowMixedOptions ? new AfterFirstSubCommand( commandLine ) 
: new AfterOptions( commandLine );
-        }
-    }
-
-    private class BeforeFirstSubCommand
-        extends OptionAwareParserState
-    {
-        private BeforeFirstSubCommand( ParsedCommandLine commandLine )
-        {
-            super( commandLine );
-        }
-
-        @Override
-        public OptionParserState onStartOption( String arg, String option )
-        {
-            OptionString optionString = new OptionString( arg, option );
-            CommandLineOption commandLineOption = optionsByString.get( option 
);
-            if ( commandLineOption == null )
-            {
-                if ( allowUnknownOptions )
-                {
-                    return new UnknownOptionParserState( arg, commandLine, 
this );
-                }
-                else
-                {
-                    throw new CommandLineArgumentException( String.format( 
"Unknown command-line option '%s'.",
-                                                                           
optionString ) );
-                }
-            }
-            return new KnownOptionParserState( optionString, 
commandLineOption, commandLine, this );
-        }
-    }
-
-    private class AfterFirstSubCommand
-        extends OptionAwareParserState
-    {
-        private AfterFirstSubCommand( ParsedCommandLine commandLine )
-        {
-            super( commandLine );
-        }
-
-        @Override
-        public OptionParserState onStartOption( String arg, String option )
-        {
-            CommandLineOption commandLineOption = optionsByString.get( option 
);
-            if ( commandLineOption == null )
-            {
-                return new UnknownOptionParserState( arg, commandLine, this );
-            }
-            return new KnownOptionParserState( new OptionString( arg, option 
), commandLineOption, commandLine, this );
-        }
-    }
-
-    private static class AfterOptions
-        extends ParserState
-    {
-        private final ParsedCommandLine commandLine;
-
-        private AfterOptions( ParsedCommandLine commandLine )
-        {
-            this.commandLine = commandLine;
-        }
-
-        @Override
-        public boolean maybeStartOption( String arg )
-        {
-            return false;
-        }
-
-        @Override
-        public OptionParserState onStartOption( String arg, String option )
-        {
-            return new UnknownOptionParserState( arg, commandLine, this );
-        }
-
-        @Override
-        public ParserState onNonOption( String arg )
-        {
-            commandLine.addExtraValue( arg );
-            return this;
-        }
-    }
-
-    private static class MissingOptionArgState
-        extends ParserState
-    {
-        private final OptionParserState option;
-
-        private MissingOptionArgState( OptionParserState option )
-        {
-            this.option = option;
-        }
-
-        @Override
-        public boolean maybeStartOption( String arg )
-        {
-            return isOption( arg );
-        }
-
-        @Override
-        public OptionParserState onStartOption( String arg, String option )
-        {
-            return this.option.onComplete().onStartOption( arg, option );
-        }
-
-        @Override
-        public ParserState onNonOption( String arg )
-        {
-            return option.onArgument( arg );
-        }
-
-        @Override
-        public void onCommandLineEnd()
-        {
-            option.onComplete();
-        }
-    }
-
-    private abstract static class OptionParserState
-    {
-        public abstract ParserState onStartNextArg();
-
-        public abstract ParserState onArgument( String argument );
-
-        public abstract boolean getHasArgument();
-
-        public abstract ParserState onComplete();
-    }
-
-    private class KnownOptionParserState
-        extends OptionParserState
-    {
-        private final OptionString optionString;
-
-        private final CommandLineOption option;
-
-        private final ParsedCommandLine commandLine;
-
-        private final ParserState state;
-
-        private final List<String> values = new ArrayList<String>();
-
-        private KnownOptionParserState( OptionString optionString, 
CommandLineOption option,
-                                        ParsedCommandLine commandLine, 
ParserState state )
-        {
-            this.optionString = optionString;
-            this.option = option;
-            this.commandLine = commandLine;
-            this.state = state;
-        }
-
-        @Override
-        public ParserState onArgument( String argument )
-        {
-            if ( !getHasArgument() )
-            {
-                throw new CommandLineArgumentException( String.format( 
"Command-line option '%s' does not"
-                    + " take an argument.", optionString ) );
-            }
-            if ( argument.length() == 0 )
-            {
-                throw new CommandLineArgumentException( String.format( "An 
empty argument was provided"
-                    + " for command-line option '%s'.", optionString ) );
-            }
-            values.add( argument );
-            return onComplete();
-        }
-
-        @Override
-        public ParserState onStartNextArg()
-        {
-            if ( option.getAllowsArguments() && values.isEmpty() )
-            {
-                return new MissingOptionArgState( this );
-            }
-            return onComplete();
-        }
-
-        @Override
-        public boolean getHasArgument()
-        {
-            return option.getAllowsArguments();
-        }
-
-        @Override
-        public ParserState onComplete()
-        {
-            if ( getHasArgument() && values.isEmpty() )
-            {
-                throw new CommandLineArgumentException( String.format( "No 
argument was provided"
-                    + " for command-line option '%s'.", optionString ) );
-            }
-
-            ParsedCommandLineOption parsedOption = commandLine.addOption( 
optionString.option, option );
-            if ( values.size() + parsedOption.getValues().size() > 1 && 
!option.getAllowsMultipleArguments() )
-            {
-                throw new CommandLineArgumentException( String.format( 
"Multiple arguments were provided"
-                    + " for command-line option '%s'.", optionString ) );
-            }
-            for ( String value : values )
-            {
-                parsedOption.addArgument( value );
-            }
-            if ( option.getDeprecationWarning() != null )
-            {
-                deprecationPrinter.println( "The " + optionString + " option 
is deprecated - "
-                    + option.getDeprecationWarning() );
-            }
-            if ( option.getSubcommand() != null )
-            {
-                return state.onNonOption( option.getSubcommand() );
-            }
-
-            return state;
-        }
-    }
-
-    private static class UnknownOptionParserState
-        extends OptionParserState
-    {
-        private final ParserState state;
-
-        private final String arg;
-
-        private final ParsedCommandLine commandLine;
-
-        private UnknownOptionParserState( String arg, ParsedCommandLine 
commandLine, ParserState state )
-        {
-            this.arg = arg;
-            this.commandLine = commandLine;
-            this.state = state;
-        }
-
-        @Override
-        public boolean getHasArgument()
-        {
-            return true;
-        }
-
-        @Override
-        public ParserState onStartNextArg()
-        {
-            return onComplete();
-        }
-
-        @Override
-        public ParserState onArgument( String argument )
-        {
-            return onComplete();
-        }
-
-        @Override
-        public ParserState onComplete()
-        {
-            commandLine.addExtraValue( arg );
-            return state;
-        }
-    }
-
-    private static final class OptionComparator
-        implements Comparator<CommandLineOption>
-    {
-        public int compare( CommandLineOption option1, CommandLineOption 
option2 )
-        {
-            String min1 = Collections.min( option1.getOptions(), new 
OptionStringComparator() );
-            String min2 = Collections.min( option2.getOptions(), new 
OptionStringComparator() );
-            return new CaseInsensitiveStringComparator().compare( min1, min2 );
-        }
-    }
-
-    private static final class CaseInsensitiveStringComparator
-        implements Comparator<String>
-    {
-        public int compare( String option1, String option2 )
-        {
-            int diff = option1.compareToIgnoreCase( option2 );
-            if ( diff != 0 )
-            {
-                return diff;
-            }
-            return option1.compareTo( option2 );
-        }
-    }
-
-    private static final class OptionStringComparator
-        implements Comparator<String>
-    {
-        public int compare( String option1, String option2 )
-        {
-            boolean short1 = option1.length() == 1;
-            boolean short2 = option2.length() == 1;
-            if ( short1 && !short2 )
-            {
-                return -1;
-            }
-            if ( !short1 && short2 )
-            {
-                return 1;
-            }
-            return new CaseInsensitiveStringComparator().compare( option1, 
option2 );
-        }
-    }
-}
diff --git 
a/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/ParsedCommandLine.java
 
b/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/ParsedCommandLine.java
deleted file mode 100644
index 5e0abcb..0000000
--- 
a/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/ParsedCommandLine.java
+++ /dev/null
@@ -1,140 +0,0 @@
-package org.apache.maven.wrapper.cli;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Parsed command line.
- */
-public class ParsedCommandLine
-{
-    private final Map<String, ParsedCommandLineOption> optionsByString = new 
HashMap<String, ParsedCommandLineOption>();
-
-    private final Set<String> presentOptions = new HashSet<String>();
-
-    private final List<String> extraArguments = new ArrayList<String>();
-
-    ParsedCommandLine( Iterable<CommandLineOption> options )
-    {
-        for ( CommandLineOption option : options )
-        {
-            ParsedCommandLineOption parsedOption = new 
ParsedCommandLineOption();
-            for ( String optionStr : option.getOptions() )
-            {
-                optionsByString.put( optionStr, parsedOption );
-            }
-        }
-    }
-
-    @Override
-    public String toString()
-    {
-        return String.format( "options: %s, extraArguments: %s", quoteAndJoin( 
presentOptions ),
-                              quoteAndJoin( extraArguments ) );
-    }
-
-    private String quoteAndJoin( Iterable<String> strings )
-    {
-        StringBuilder output = new StringBuilder();
-        boolean isFirst = true;
-        for ( String string : strings )
-        {
-            if ( !isFirst )
-            {
-                output.append( ", " );
-            }
-            output.append( "'" );
-            output.append( string );
-            output.append( "'" );
-            isFirst = false;
-        }
-        return output.toString();
-    }
-
-    /**
-     * Returns true if the given option is present in this command-line.
-     * 
-     * @param option The option, without the '-' or '--' prefix.
-     * @return true if the option is present.
-     */
-    public boolean hasOption( String option )
-    {
-        option( option );
-        return presentOptions.contains( option );
-    }
-
-    /**
-     * See also {@link #hasOption}.
-     * 
-     * @param logLevelOptions the options to check
-     * @return true if any of the passed options is present
-     */
-    public boolean hasAnyOption( Collection<String> logLevelOptions )
-    {
-        for ( String option : logLevelOptions )
-        {
-            if ( hasOption( option ) )
-            {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Returns the value of the given option.
-     * 
-     * @param option The option, without the '-' or '--' prefix.
-     * @return The option. never returns null.
-     */
-    public ParsedCommandLineOption option( String option )
-    {
-        ParsedCommandLineOption parsedOption = optionsByString.get( option );
-        if ( parsedOption == null )
-        {
-            throw new IllegalArgumentException( String.format( "Option '%s' 
not defined.", option ) );
-        }
-        return parsedOption;
-    }
-
-    public List<String> getExtraArguments()
-    {
-        return extraArguments;
-    }
-
-    void addExtraValue( String value )
-    {
-        extraArguments.add( value );
-    }
-
-    ParsedCommandLineOption addOption( String optionStr, CommandLineOption 
option )
-    {
-        ParsedCommandLineOption parsedOption = optionsByString.get( optionStr 
);
-        presentOptions.addAll( option.getOptions() );
-        return parsedOption;
-    }
-}
diff --git 
a/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/ParsedCommandLineOption.java
 
b/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/ParsedCommandLineOption.java
deleted file mode 100644
index 7139ec5..0000000
--- 
a/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/ParsedCommandLineOption.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.apache.maven.wrapper.cli;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Parsed command line option.
- */
-public class ParsedCommandLineOption
-{
-    private final List<String> values = new ArrayList<String>();
-
-    public String getValue()
-    {
-        if ( !hasValue() )
-        {
-            throw new IllegalStateException( "Option does not have any value." 
);
-        }
-        if ( values.size() > 1 )
-        {
-            throw new IllegalStateException( "Option has multiple values." );
-        }
-        return values.get( 0 );
-    }
-
-    public List<String> getValues()
-    {
-        return values;
-    }
-
-    public void addArgument( String argument )
-    {
-        values.add( argument );
-    }
-
-    public boolean hasValue()
-    {
-        return !values.isEmpty();
-    }
-}
diff --git 
a/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/ProjectPropertiesCommandLineConverter.java
 
b/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/ProjectPropertiesCommandLineConverter.java
deleted file mode 100644
index 90c8c6b..0000000
--- 
a/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/ProjectPropertiesCommandLineConverter.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.apache.maven.wrapper.cli;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Converter from project properties.
- */
-public class ProjectPropertiesCommandLineConverter
-    extends AbstractPropertiesCommandLineConverter
-{
-
-    @Override
-    protected String getPropertyOption()
-    {
-        return "P";
-    }
-
-    @Override
-    protected String getPropertyOptionDetailed()
-    {
-        return "project-prop";
-    }
-
-    @Override
-    protected String getPropertyOptionDescription()
-    {
-        return "Set project property for the build script (e.g. 
-Pmyprop=myvalue).";
-    }
-}
diff --git 
a/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/SystemPropertiesCommandLineConverter.java
 
b/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/SystemPropertiesCommandLineConverter.java
deleted file mode 100644
index 70f5edf..0000000
--- 
a/maven-wrapper/src/main/java/org/apache/maven/wrapper/cli/SystemPropertiesCommandLineConverter.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.apache.maven.wrapper.cli;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-/**
- * Converter from system properties.
- */
-public class SystemPropertiesCommandLineConverter
-    extends AbstractPropertiesCommandLineConverter
-{
-
-    @Override
-    protected String getPropertyOption()
-    {
-        return "D";
-    }
-
-    @Override
-    protected String getPropertyOptionDetailed()
-    {
-        return "system-prop";
-    }
-
-    @Override
-    protected String getPropertyOptionDescription()
-    {
-        return "Set system property of the JVM (e.g. -Dmyprop=myvalue).";
-    }
-}
\ No newline at end of file
diff --git 
a/maven-wrapper/src/test/java/org/apache/maven/wrapper/SystemPropertiesHandlerTest.java
 
b/maven-wrapper/src/test/java/org/apache/maven/wrapper/SystemPropertiesHandlerTest.java
deleted file mode 100644
index b5112ea..0000000
--- 
a/maven-wrapper/src/test/java/org/apache/maven/wrapper/SystemPropertiesHandlerTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.apache.maven.wrapper;
-
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.equalTo;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.commons.io.IOUtils;
-import org.junit.Before;
-import org.junit.Test;
-
-public class SystemPropertiesHandlerTest {
-
-  private File tmpDir = new 
File("target/test-files/SystemPropertiesHandlerTest");
-
-  @Before
-  public void setupTempDir() {
-    tmpDir.mkdirs();
-  }
-
-  @Test
-  public void testParsePropertiesFile() throws Exception {
-    File propFile = new File(tmpDir, "props");
-    Properties props = new Properties();
-    props.put("a", "b");
-    props.put("systemProp.c", "d");
-    props.put("systemProp.", "e");
-
-    FileOutputStream fos = null;
-    try {
-      fos = new FileOutputStream(propFile);
-      props.store(fos, "");
-    } finally {
-      IOUtils.closeQuietly(fos);
-    }
-
-    Map<String, String> expected = new HashMap<String, String>();
-    expected.put("c", "d");
-
-    assertThat(SystemPropertiesHandler.getSystemProperties(propFile), 
equalTo(expected));
-  }
-
-  @Test
-  public void ifNoPropertyFileExistShouldReturnEmptyMap() {
-    Map<String, String> expected = new HashMap<String, String>();
-    assertThat(SystemPropertiesHandler.getSystemProperties(new File(tmpDir, 
"unknown")), equalTo(expected));
-  }
-}

Reply via email to