FELIX-3210: only request user input in interactive mode

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1203897 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrRemoteClean.java b/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrRemoteClean.java
index 5363d89..a326225 100644
--- a/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrRemoteClean.java
+++ b/bundleplugin/src/main/java/org/apache/felix/obrplugin/ObrRemoteClean.java
@@ -131,6 +131,12 @@
     private String obrDeploymentRepository;
 
     /**
+     * @parameter default-value="${settings.interactiveMode}"
+     * @readonly
+     */
+    private boolean interactive;
+
+    /**
      * The Maven project.
      * 
      * @parameter expression="${project}"
@@ -325,18 +331,21 @@
         Date d = new Date();
         if ( toRemove.size() > 0 )
         {
-            System.out.println( "Do you want to remove these bundles from the repository file [y/N]:" );
-            BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );
-            String answer = null;
+            String answer = "y";
+            if ( interactive )
+            {
+                System.out.println( "Do you want to remove these bundles from the repository file [y/N]:" );
+                BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );
 
-            try
-            {
-                answer = br.readLine();
-            }
-            catch ( IOException ioe )
-            {
-                getLog().error( "IO error trying to read the user confirmation" );
-                return null;
+                try
+                {
+                    answer = br.readLine();
+                }
+                catch ( IOException ioe )
+                {
+                    getLog().error( "IO error trying to read the user confirmation" );
+                    return null;
+                }
             }
 
             if ( answer != null && answer.trim().equalsIgnoreCase( "y" ) )