BATCHEE-121 ensure cli can use default values for options
diff --git a/tools/cli/src/main/assembly/bin-openejb.xml b/tools/cli/src/main/assembly/bin-openejb.xml
index f90b11b..ac62885 100644
--- a/tools/cli/src/main/assembly/bin-openejb.xml
+++ b/tools/cli/src/main/assembly/bin-openejb.xml
@@ -45,6 +45,15 @@
       <outputDirectory>conf/</outputDirectory>
       <includes>
         <include>logging.properties</include>
+        <include>batchee-cli_openejb.properties</include>
+      </includes>
+      <lineEnding>unix</lineEnding>
+    </fileSet>
+    <fileSet>
+      <directory>${project.build.outputDirectory}/openejb</directory>
+      <outputDirectory>conf/</outputDirectory>
+      <includes>
+        <include>batchee-cli.properties</include>
       </includes>
       <lineEnding>unix</lineEnding>
     </fileSet>
diff --git a/tools/cli/src/main/assembly/bin.xml b/tools/cli/src/main/assembly/bin.xml
index 8420401..35c58c3 100644
--- a/tools/cli/src/main/assembly/bin.xml
+++ b/tools/cli/src/main/assembly/bin.xml
@@ -49,6 +49,14 @@
       <lineEnding>unix</lineEnding>
     </fileSet>
     <fileSet>
+      <directory>${project.build.outputDirectory}/default</directory>
+      <outputDirectory>conf/</outputDirectory>
+      <includes>
+        <include>batchee-cli.properties</include>
+      </includes>
+      <lineEnding>unix</lineEnding>
+    </fileSet>
+    <fileSet>
       <directory>${project.build.directory}/</directory>
       <outputDirectory>bin/</outputDirectory>
       <includes>
diff --git a/tools/cli/src/main/java/org/apache/batchee/cli/BatchEECLI.java b/tools/cli/src/main/java/org/apache/batchee/cli/BatchEECLI.java
index 4ebb4eb..41ad0b6 100644
--- a/tools/cli/src/main/java/org/apache/batchee/cli/BatchEECLI.java
+++ b/tools/cli/src/main/java/org/apache/batchee/cli/BatchEECLI.java
@@ -40,6 +40,10 @@
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
 
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.Reader;
 import java.lang.reflect.Field;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
@@ -50,6 +54,7 @@
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Properties;
 import java.util.ServiceLoader;
 import java.util.TreeMap;
 
@@ -112,6 +117,49 @@
         final Collection<String> newArgs = new ArrayList<String>(asList(args));
         newArgs.remove(newArgs.iterator().next());
 
+        final File cliConf;
+        String home = System.getProperty("batchee.home");
+        if (home == null) {
+            final String conf = System.getProperty("batchee.cli.configuration");
+            if (conf == null) {
+                cliConf = null;
+            } else {
+                cliConf = new File(conf);
+            }
+        } else {
+            cliConf = new File(home, "conf/batchee-cli.properties");
+        }
+        if (cliConf != null && cliConf.exists()) {
+            final Properties properties = new Properties() {{
+                Reader reader = null;
+                try {
+                    reader = new FileReader(cliConf);
+                    load(reader);
+                } catch (IOException e) {
+                    throw new IllegalArgumentException(e);
+                } finally {
+                    if (reader != null) {
+                        try {
+                            reader.close();
+                        } catch (final IOException e) {
+                            // no-op
+                        }
+                    }
+                }
+            }};
+            for (final String key : properties.stringPropertyNames()) {
+                if (key.startsWith("_arguments.")) { // /!\ added whatever passed values are
+                    newArgs.add(properties.getProperty(key));
+                } else {
+                    final String opt = "-" + key;
+                    if (!newArgs.contains(opt)) {
+                        newArgs.add(opt);
+                        newArgs.add(properties.getProperty(key));
+                    }
+                }
+            }
+        }
+
         final CommandLineParser parser = new DefaultParser();
         try {
             final CommandLine line = parser.parse(options, newArgs.toArray(new String[newArgs.size()]));
diff --git a/tools/cli/src/main/java/org/apache/batchee/cli/command/JobOperatorCommand.java b/tools/cli/src/main/java/org/apache/batchee/cli/command/JobOperatorCommand.java
index 3421bcf..bec981d 100644
--- a/tools/cli/src/main/java/org/apache/batchee/cli/command/JobOperatorCommand.java
+++ b/tools/cli/src/main/java/org/apache/batchee/cli/command/JobOperatorCommand.java
@@ -175,10 +175,6 @@
             final Lifecycle<Object> lifecycleInstance;
             final Object state;
 
-            if (lifecycle == null) {
-                lifecycle = System.getProperty("org.apache.batchee.cli.lifecycle");
-            }
-
             if (lifecycle != null) {
                 lifecycleInstance = createLifecycle(loader);
                 state = lifecycleInstance.start();
diff --git a/tools/cli/src/main/resources/default/batchee-cli.properties b/tools/cli/src/main/resources/default/batchee-cli.properties
new file mode 100644
index 0000000..40226a0
--- /dev/null
+++ b/tools/cli/src/main/resources/default/batchee-cli.properties
@@ -0,0 +1,24 @@
+#
+# 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.
+
+
+#
+# You can put here default options you want inherited by all commands (without trailing iphen).
+#
+
+# ex:
+# lifecycle = openejb
+# sharedLibs = /opt/batch/libs
diff --git a/tools/cli/src/main/resources/openejb/batchee-cli.properties b/tools/cli/src/main/resources/openejb/batchee-cli.properties
new file mode 100644
index 0000000..50f452c
--- /dev/null
+++ b/tools/cli/src/main/resources/openejb/batchee-cli.properties
@@ -0,0 +1,26 @@
+#
+# 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.
+
+
+#
+# You can put here default options you want inherited by all commands (without trailing iphen).
+#
+
+# ex:
+# sharedLibs = /opt/batch/libs
+
+lifecycle = openejb
+