[maven-help-plugin] branch master updated: [MPH-154] The output of the plugin should be flushed when using forceStdout

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[maven-help-plugin] branch master updated: [MPH-154] The output of the plugin should be flushed when using forceStdout

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

rfscholte pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-help-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new 26224aa  [MPH-154] The output of the plugin should be flushed when using forceStdout
26224aa is described below

commit 26224aa40d6a8dcd383ecdb823d1a60d1bb9b485
Author: rfscholte <[hidden email]>
AuthorDate: Wed Nov 7 20:57:42 2018 +0100

    [MPH-154] The output of the plugin should be flushed when using forceStdout
---
 src/it/evaluate-forceStdout/invoker.properties     | 19 +++++++++++
 src/it/evaluate-forceStdout/pom.xml                | 37 ++++++++++++++++++++++
 src/it/evaluate-forceStdout/test.properties        | 19 +++++++++++
 src/it/evaluate-forceStdout/verify.groovy          | 20 ++++++++++++
 .../apache/maven/plugins/help/EvaluateMojo.java    |  1 +
 5 files changed, 96 insertions(+)

diff --git a/src/it/evaluate-forceStdout/invoker.properties b/src/it/evaluate-forceStdout/invoker.properties
new file mode 100644
index 0000000..13d149d
--- /dev/null
+++ b/src/it/evaluate-forceStdout/invoker.properties
@@ -0,0 +1,19 @@
+# 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.
+
+invoker.goals = ${project.groupId}:${project.artifactId}:${project.version}:evaluate -q
+invoker.debug = false
diff --git a/src/it/evaluate-forceStdout/pom.xml b/src/it/evaluate-forceStdout/pom.xml
new file mode 100644
index 0000000..aabc9fd
--- /dev/null
+++ b/src/it/evaluate-forceStdout/pom.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+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.
+-->
+
+<project>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.help</groupId>
+  <artifactId>test</artifactId>
+  <version>1.0</version>
+
+  <description>
+    The description.
+  </description>
+
+  <build>
+    <plugins>
+    </plugins>
+  </build>
+</project>
diff --git a/src/it/evaluate-forceStdout/test.properties b/src/it/evaluate-forceStdout/test.properties
new file mode 100644
index 0000000..a14aca6
--- /dev/null
+++ b/src/it/evaluate-forceStdout/test.properties
@@ -0,0 +1,19 @@
+# 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.
+
+expression = project.version
+forceStdout = true
diff --git a/src/it/evaluate-forceStdout/verify.groovy b/src/it/evaluate-forceStdout/verify.groovy
new file mode 100644
index 0000000..09ff343
--- /dev/null
+++ b/src/it/evaluate-forceStdout/verify.groovy
@@ -0,0 +1,20 @@
+/*
+ * 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.
+ */
+
+assert '1.0' == new File(basedir, 'build.log').readLines().findAll{ !it.startsWith('Picked up JAVA_TOOL_OPTIONS: ') }.first()
diff --git a/src/main/java/org/apache/maven/plugins/help/EvaluateMojo.java b/src/main/java/org/apache/maven/plugins/help/EvaluateMojo.java
index f25b98b..9678091 100644
--- a/src/main/java/org/apache/maven/plugins/help/EvaluateMojo.java
+++ b/src/main/java/org/apache/maven/plugins/help/EvaluateMojo.java
@@ -404,6 +404,7 @@ public class EvaluateMojo
                 if ( forceStdout )
                 {
                     System.out.print( response.toString() );
+                    System.out.flush();
                 }
             }
         }