svn commit: r1802097 - in /maven/plugins/trunk/maven-invoker-plugin/src: it/postbuild-executed-only-once/ it/postbuild-executed-only-once/src/ it/postbuild-executed-only-once/src/it/ it/postbuild-executed-only-once/src/it/project/ it/postbuild-executed...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

svn commit: r1802097 - in /maven/plugins/trunk/maven-invoker-plugin/src: it/postbuild-executed-only-once/ it/postbuild-executed-only-once/src/ it/postbuild-executed-only-once/src/it/ it/postbuild-executed-only-once/src/it/project/ it/postbuild-executed...

olamy
Author: olamy
Date: Mon Jul 17 06:32:01 2017
New Revision: 1802097

URL: http://svn.apache.org/viewvc?rev=1802097&view=rev
Log:
[MINVOKER-223]  ensure post build script is executed only once

Added:
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/pom.xml   (with props)
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/invoker.properties   (with props)
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/pom.xml   (with props)
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/postbuild.bsh
      - copied, changed from r1802046, maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/setup.groovy
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/main/
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/main/java/
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/main/java/org/
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/main/java/org/apache/
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/main/java/org/apache/maven/
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/main/java/org/apache/maven/plugins/
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/main/java/org/apache/maven/plugins/invoker/
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/main/java/org/apache/maven/plugins/invoker/it/
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/main/java/org/apache/maven/plugins/invoker/it/post_executed_only_once/
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/main/java/org/apache/maven/plugins/invoker/it/post_executed_only_once/App.java
      - copied, changed from r1802046, maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/setup.groovy
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/test/
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/test/java/
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/test/java/org/
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/test/java/org/apache/
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/test/java/org/apache/maven/
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/test/java/org/apache/maven/plugins/
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/test/java/org/apache/maven/plugins/invoker/
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/test/java/org/apache/maven/plugins/invoker/it/
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/test/java/org/apache/maven/plugins/invoker/it/post_executed_only_once/
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/test/java/org/apache/maven/plugins/invoker/it/post_executed_only_once/AppTest.java
      - copied, changed from r1802046, maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/setup.groovy
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/system2.properties   (with props)
    maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/verify.bsh
      - copied, changed from r1802046, maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/setup.groovy
Modified:
    maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/setup.groovy
    maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/verify.bsh
    maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java

Added: maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/pom.xml?rev=1802097&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/pom.xml (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/pom.xml Mon Jul 17 06:32:01 2017
@@ -0,0 +1,65 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.plugins.invoker</groupId>
+  <artifactId>fail-postbuild</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <description>Test to check that a failure of the post-build hook fails the parent build, too.</description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-invoker-plugin</artifactId>
+        <version>@pom.version@</version>
+        <configuration>
+          <debug>true</debug>
+          <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
+          <pomIncludes>
+            <pomInclude>*/pom.xml</pomInclude>
+          </pomIncludes>
+          <goals>
+            <goal>validate</goal>
+          </goals>
+        </configuration>
+        <executions>
+          <execution>
+            <id>integration-test</id>
+            <phase>initialize</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/invoker.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/invoker.properties?rev=1802097&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/invoker.properties (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/invoker.properties Mon Jul 17 06:32:01 2017
@@ -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.
+
+invoker.goals.1 = clean test
+invoker.goals.2 = clean test
+invoker.systemPropertiesFile.2 = system2.properties

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/invoker.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/invoker.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/pom.xml
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/pom.xml?rev=1802097&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/pom.xml (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/pom.xml Mon Jul 17 06:32:01 2017
@@ -0,0 +1,64 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.plugins.invoker.it.post_executed_only_once</groupId>
+  <artifactId>post_executed_only_once</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>jar</packaging>
+
+  <name>post_executed_only_once</name>
+  <url>http://maven.apache.org</url>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+    <create_touch_file>false</create_touch_file>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <version>4.12</version>
+      <scope>test</scope>
+    </dependency>
+  </dependencies>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <version>2.20</version>
+          <configuration>
+            <systemPropertyVariables>
+              <create_touch_file>${create_touch_file}</create_touch_file>
+              <touch_file_path>${project.build.directory}</touch_file_path>
+            </systemPropertyVariables>
+          </configuration>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+
+</project>

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/postbuild.bsh (from r1802046, maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/setup.groovy)
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/postbuild.bsh?p2=maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/postbuild.bsh&p1=maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/setup.groovy&r1=1802046&r2=1802097&rev=1802097&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/setup.groovy (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/postbuild.bsh Mon Jul 17 06:32:01 2017
@@ -17,12 +17,24 @@
  * under the License.
  */
 
-import java.io.File
-import org.apache.commons.io.FileUtils
+import java.io.*;
+import java.util.*;
+import java.util.regex.*;
+
+try
+{
+    File touchFile = new File( basedir, "target/touch.txt" );
+    System.out.println( "Checking for existence of touch file: " + touchFile );
+    if ( !touchFile.exists() )
+    {
+        System.out.println( "touch.txt not exists FAILED!" );
+        return false;
+    }
+}
+catch( Throwable t )
+{
+    t.printStackTrace();
+    return false;
+}
 
-// Previous potential target 'content' has impact on IT execution
-// (Some new file should be created by verify.sh)
-FileUtils.deleteQuietly( new File( basedir, "target/invoker-reports" ) );
-FileUtils.deleteQuietly( new File( basedir, "src/it/script-ret-quiet/target" ) );
-FileUtils.deleteQuietly( new File( basedir, "src/it/script-ret-true/target" ) );
 return true;

Copied: maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/main/java/org/apache/maven/plugins/invoker/it/post_executed_only_once/App.java (from r1802046, maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/setup.groovy)
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/main/java/org/apache/maven/plugins/invoker/it/post_executed_only_once/App.java?p2=maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/main/java/org/apache/maven/plugins/invoker/it/post_executed_only_once/App.java&p1=maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/setup.groovy&r1=1802046&r2=1802097&rev=1802097&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/setup.groovy (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/main/java/org/apache/maven/plugins/invoker/it/post_executed_only_once/App.java Mon Jul 17 06:32:01 2017
@@ -1,3 +1,5 @@
+package org.apache.maven.plugins.invoker.it.post_executed_only_once;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -6,9 +8,9 @@
  * 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
@@ -17,12 +19,18 @@
  * under the License.
  */
 
-import java.io.File
-import org.apache.commons.io.FileUtils
+import java.io.File;
 
-// Previous potential target 'content' has impact on IT execution
-// (Some new file should be created by verify.sh)
-FileUtils.deleteQuietly( new File( basedir, "target/invoker-reports" ) );
-FileUtils.deleteQuietly( new File( basedir, "src/it/script-ret-quiet/target" ) );
-FileUtils.deleteQuietly( new File( basedir, "src/it/script-ret-true/target" ) );
-return true;
+public class App
+{
+    public boolean createFile()
+        throws Exception
+    {
+        if ( Boolean.getBoolean( "create_touch_file" ) )
+        {
+            File touch = new File( System.getProperty( "touch_file_path" ), "touch.txt" );
+            return touch.createNewFile();
+        }
+        return false;
+    }
+}

Copied: maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/test/java/org/apache/maven/plugins/invoker/it/post_executed_only_once/AppTest.java (from r1802046, maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/setup.groovy)
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/test/java/org/apache/maven/plugins/invoker/it/post_executed_only_once/AppTest.java?p2=maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/test/java/org/apache/maven/plugins/invoker/it/post_executed_only_once/AppTest.java&p1=maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/setup.groovy&r1=1802046&r2=1802097&rev=1802097&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/setup.groovy (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/src/test/java/org/apache/maven/plugins/invoker/it/post_executed_only_once/AppTest.java Mon Jul 17 06:32:01 2017
@@ -1,3 +1,5 @@
+package org.apache.maven.plugins.invoker.it.post_executed_only_once;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -6,9 +8,9 @@
  * 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
@@ -17,12 +19,17 @@
  * under the License.
  */
 
-import java.io.File
-import org.apache.commons.io.FileUtils
+import junit.framework.TestCase;
+import org.junit.Test;
 
-// Previous potential target 'content' has impact on IT execution
-// (Some new file should be created by verify.sh)
-FileUtils.deleteQuietly( new File( basedir, "target/invoker-reports" ) );
-FileUtils.deleteQuietly( new File( basedir, "src/it/script-ret-quiet/target" ) );
-FileUtils.deleteQuietly( new File( basedir, "src/it/script-ret-true/target" ) );
-return true;
+public class AppTest
+    extends TestCase
+{
+    @Test
+    public void testApp()
+        throws Exception
+    {
+        new App().createFile();
+        assertTrue( true );
+    }
+}

Added: maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/system2.properties
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/system2.properties?rev=1802097&view=auto
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/system2.properties (added)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/system2.properties Mon Jul 17 06:32:01 2017
@@ -0,0 +1,18 @@
+# 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.
+
+create_touch_file = true

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/system2.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/src/it/project/system2.properties
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Copied: maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/verify.bsh (from r1802046, maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/setup.groovy)
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/verify.bsh?p2=maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/verify.bsh&p1=maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/setup.groovy&r1=1802046&r2=1802097&rev=1802097&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/setup.groovy (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/postbuild-executed-only-once/verify.bsh Mon Jul 17 06:32:01 2017
@@ -17,12 +17,25 @@
  * under the License.
  */
 
-import java.io.File
-import org.apache.commons.io.FileUtils
+import java.io.*;
+import java.util.*;
+import java.util.regex.*;
+
+try
+{
+    // make sure the Invoker Plugin was indeed run and the build didn't fail somewhere else
+    File touchFile = new File( basedir, "target/it/project/target/touch.txt" );
+    System.out.println( "Checking for existence of touch file: " + touchFile );
+    if ( !touchFile.exists() )
+    {
+        System.out.println( "FAILED!" );
+        return false;
+    }
+}
+catch( Throwable t )
+{
+    t.printStackTrace();
+    return false;
+}
 
-// Previous potential target 'content' has impact on IT execution
-// (Some new file should be created by verify.sh)
-FileUtils.deleteQuietly( new File( basedir, "target/invoker-reports" ) );
-FileUtils.deleteQuietly( new File( basedir, "src/it/script-ret-quiet/target" ) );
-FileUtils.deleteQuietly( new File( basedir, "src/it/script-ret-true/target" ) );
 return true;

Modified: maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/setup.groovy
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/setup.groovy?rev=1802097&r1=1802096&r2=1802097&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/setup.groovy (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/setup.groovy Mon Jul 17 06:32:01 2017
@@ -17,7 +17,6 @@
  * under the License.
  */
 
-import java.io.File
 import org.apache.commons.io.FileUtils
 
 // Previous potential target 'content' has impact on IT execution

Modified: maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/verify.bsh
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/verify.bsh?rev=1802097&r1=1802096&r2=1802097&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/verify.bsh (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/it/selector-scripts/verify.bsh Mon Jul 17 06:32:01 2017
@@ -51,7 +51,7 @@ try
         System.out.println( "Checking for absence of: " + touchFile );
         if ( touchFile.exists() )
         {
-            System.out.println( "FAILED!" );
+            System.out.println( file  + " should not be here -> FAILED!" );
             return false;
         }
     }
@@ -67,7 +67,7 @@ try
          String xml = FileUtils.fileRead( resultFile, "UTF-8" );
          if ( xml.indexOf("result=\"success\"") < 0 && xml.indexOf("result='success'") < 0 )
          {
-             System.out.println( "FAILED!" );
+             System.out.println( resultFile + " not success -> FAILED!" );
              return false;
          }
     }
@@ -83,7 +83,7 @@ try
          String xml = FileUtils.fileRead( resultFile, "UTF-8" );
          if ( xml.indexOf("result=\"skipped\"") < 0 && xml.indexOf("result='skipped'") < 0 )
          {
-             System.out.println( "FAILED!" );
+             System.out.println( resultFile + " not skipped -> FAILED!" );
              return false;
          }
     }
@@ -99,7 +99,7 @@ try
          String xml = FileUtils.fileRead( resultFile, "UTF-8" );
          if ( xml.indexOf("result=\"error\"") < 0 && xml.indexOf("result='error'") < 0 )
          {
-             System.out.println( "FAILED!" );
+             System.out.println( resultFile + " not failed -> FAILED!" );
              return false;
          }
     }

Modified: maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java?rev=1802097&r1=1802096&r2=1802097&view=diff
==============================================================================
--- maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java (original)
+++ maven/plugins/trunk/maven-invoker-plugin/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java Mon Jul 17 06:32:01 2017
@@ -1755,6 +1755,7 @@ public abstract class AbstractInvokerMoj
         Map<String, Object> context = new LinkedHashMap<String, Object>();
 
         FileLogger logger = setupBuildLogFile( basedir );
+        boolean selectorResult = true;
         try
         {
             try
@@ -1764,10 +1765,12 @@ public abstract class AbstractInvokerMoj
             }
             catch ( RunErrorException e )
             {
+                selectorResult = false;
                 throw e;
             }
             catch ( RunFailureException e )
             {
+                selectorResult = false;
                 return false;
             }
 
@@ -1876,7 +1879,6 @@ public abstract class AbstractInvokerMoj
                     throw new RunFailureException( "Maven invocation failed. " + e.getMessage(),
                                                    BuildJob.Result.FAILURE_BUILD );
                 }
-                runPostBuildHook( basedir, context, logger );
                 verify( result, invocationIndex, invokerProperties, logger );
             }
         }
@@ -1886,6 +1888,10 @@ public abstract class AbstractInvokerMoj
         }
         finally
         {
+            if ( selectorResult )
+            {
+                runPostBuildHook( basedir, context, logger );
+            }
             if ( logger != null )
             {
                 logger.close();


Loading...