You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2020/02/23 16:32:12 UTC

[maven-invoker-plugin] branch MINVOKER-255 updated (c1ce6d6 -> 2ea4b0e)

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

slachiewicz pushed a change to branch MINVOKER-255
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git.


 discard c1ce6d6  remove duplicate IT test
 discard d0b6843  [MINVOKER-255] support environmentVariable in invokerPropertiesFile
 discard 861a881  improve InvokerPropertiesTest
 discard ac8876e  update possible and easy dependencies
     add 808d2d2  [MINVOKER-257] Test code should meet checkstyle requirements
     add 7781edb  [MINVOKER-256] add outputTimestamp property
     new 1e9be47  update possible and easy dependencies
     new 5e74e4f  improve InvokerPropertiesTest
     new 32577cc  [MINVOKER-255] support environmentVariable in invokerPropertiesFile
     new 2ea4b0e  remove duplicate IT test

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (c1ce6d6)
            \
             N -- N -- N   refs/heads/MINVOKER-255 (2ea4b0e)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pom.xml                                            |  8 ++++
 .../plugins/invoker/ExtendedMavenProjectStub.java  |  3 +-
 .../maven/plugins/invoker/InterpolationTest.java   |  2 -
 .../maven/plugins/invoker/InvokerMojoTest.java     | 28 ++++++--------
 .../plugins/invoker/InvokerPropertiesTest.java     | 45 +++++++++++++---------
 .../apache/maven/plugins/invoker/SelectorTest.java |  5 ++-
 .../maven/plugins/invoker/SelectorUtilsTest.java   | 22 +++++++----
 7 files changed, 65 insertions(+), 48 deletions(-)


[maven-invoker-plugin] 03/04: [MINVOKER-255] support environmentVariable in invokerPropertiesFile

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MINVOKER-255
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit 32577cc70d7089045f660b47a1d8d986b34f1f9c
Author: Slawomir Jaranowski <s....@gmail.com>
AuthorDate: Mon Feb 17 19:08:43 2020 +0100

    [MINVOKER-255] support environmentVariable in invokerPropertiesFile
    
    Closes #13
---
 src/it/invocation-environmentvariable/pom.xml      |   1 +
 .../src/it/minvoker-145/pom.xml                    |   1 +
 .../src/it/minvoker-255/invoker.properties         |  24 ++++
 .../{ => src/it/minvoker-255}/pom.xml              | 125 ++++++++++-----------
 .../maven/plugins/invoker/AbstractInvokerMojo.java |   6 +
 .../maven/plugins/invoker/InvokerProperties.java   |  92 +++++++++++----
 .../plugins/invoker/InvokerPropertiesTest.java     |  48 +++++++-
 7 files changed, 204 insertions(+), 93 deletions(-)

diff --git a/src/it/invocation-environmentvariable/pom.xml b/src/it/invocation-environmentvariable/pom.xml
index f6646b7..d7d7f42 100644
--- a/src/it/invocation-environmentvariable/pom.xml
+++ b/src/it/invocation-environmentvariable/pom.xml
@@ -46,6 +46,7 @@ under the License.
           </goals>
           <environmentVariables>
             <MINVOKER145>foobar</MINVOKER145>
+            <MINVOKER255_POM>minvoker255_pom</MINVOKER255_POM>
           </environmentVariables>
         </configuration>
         <executions>
diff --git a/src/it/invocation-environmentvariable/src/it/minvoker-145/pom.xml b/src/it/invocation-environmentvariable/src/it/minvoker-145/pom.xml
index f3c3b04..340b0cb 100644
--- a/src/it/invocation-environmentvariable/src/it/minvoker-145/pom.xml
+++ b/src/it/invocation-environmentvariable/src/it/minvoker-145/pom.xml
@@ -25,6 +25,7 @@
 
   <profiles>
     <profile>
+      <id>envTest</id>
       <activation>
         <property>
           <name>env.MINVOKER145</name>
diff --git a/src/it/invocation-environmentvariable/src/it/minvoker-255/invoker.properties b/src/it/invocation-environmentvariable/src/it/minvoker-255/invoker.properties
new file mode 100644
index 0000000..2be833f
--- /dev/null
+++ b/src/it/invocation-environmentvariable/src/it/minvoker-255/invoker.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.
+
+invoker.name = Test Environment variable
+
+# override value from plugin config
+invoker.environmentVariables.MINVOKER145 = minvoker_145
+
+# add next value
+invoker.environmentVariables.MINVOKER255_PROPERTIES = minvoker255_properties
diff --git a/src/it/invocation-environmentvariable/pom.xml b/src/it/invocation-environmentvariable/src/it/minvoker-255/pom.xml
similarity index 62%
copy from src/it/invocation-environmentvariable/pom.xml
copy to src/it/invocation-environmentvariable/src/it/minvoker-255/pom.xml
index f6646b7..9ab12be 100644
--- a/src/it/invocation-environmentvariable/pom.xml
+++ b/src/it/invocation-environmentvariable/src/it/minvoker-255/pom.xml
@@ -1,64 +1,61 @@
-<?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.its</groupId>
-  <artifactId>invocation-environmentvariable</artifactId>
-  <version>1.0-SNAPSHOT</version>
-  <packaging>pom</packaging>
-
-  <description>Test if the environmentvariable is applied</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>@project.version@</version>
-        <configuration>
-          <debug>true</debug>
-          <goals>
-            <goal>validate</goal>
-          </goals>
-          <environmentVariables>
-            <MINVOKER145>foobar</MINVOKER145>
-          </environmentVariables>
-        </configuration>
-        <executions>
-          <execution>
-            <id>integration-test</id>
-            <phase>initialize</phase>
-            <goals>
-              <goal>run</goal>
-            </goals>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-
-</project>
+<?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.its</groupId>
+  <artifactId>minvoker-145</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-enforcer-plugin</artifactId>
+        <version>3.0.0-M3</version>
+        <executions>
+          <execution>
+            <goals>
+              <goal>enforce</goal>
+            </goals>
+            <configuration>
+              <rules>
+                <evaluateBeanshell>
+                  <condition><![CDATA[
+                    "${env.MINVOKER145}" == "minvoker_145" &&
+                    "${env.MINVOKER255_POM}" == "minvoker255_pom" &&
+                    "${env.MINVOKER255_PROPERTIES}" == "minvoker255_properties"
+                  ]]></condition>
+                </evaluateBeanshell>
+              </rules>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java b/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
index abcbb96..f772d80 100644
--- a/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
@@ -573,6 +573,12 @@ public abstract class AbstractInvokerMojo
      * # Since plugin version 3.2.1
      * invoker.ordinal = 3
      * invoker.ordinal = 1
+     *
+     * # The additional value for the environment variable.
+     * # Since plugin version 3.2.2
+     * invoker.environmentVariables.&lt;variableName&gt; = variableValue
+     * invoker.environmentVariables.MY_ENV_NAME = myEnvValue
+     *
      * </pre>
      *
      * @since 1.2
diff --git a/src/main/java/org/apache/maven/plugins/invoker/InvokerProperties.java b/src/main/java/org/apache/maven/plugins/invoker/InvokerProperties.java
index a3b8f3c..8dd7742 100644
--- a/src/main/java/org/apache/maven/plugins/invoker/InvokerProperties.java
+++ b/src/main/java/org/apache/maven/plugins/invoker/InvokerProperties.java
@@ -42,6 +42,9 @@ class InvokerProperties
 {
     private static final String SELECTOR_PREFIX = "selector.";
 
+    private static final Pattern ENVIRONMENT_VARIABLES_PATTERN =
+            Pattern.compile( "invoker\\.environmentVariables\\.([A-Za-z][^.]+)(\\.([0-9]+))?" );
+
     private enum InvocationProperty
     {
         PROJECT( "invoker.project" ),
@@ -53,9 +56,9 @@ class InvokerProperties
         OFFLINE( "invoker.offline" ),
         SYSTEM_PROPERTIES_FILE( "invoker.systemPropertiesFile" ),
         DEBUG( "invoker.debug" ),
-        SETTINGS_FILE ( "invoker.settingsFile" ),
-        TIMEOUT_IN_SECONDS ( "invoker.timeoutInSeconds" ),
-        ORDINAL ( "invoker.ordinal" );
+        SETTINGS_FILE( "invoker.settingsFile" ),
+        TIMEOUT_IN_SECONDS( "invoker.timeoutInSeconds" ),
+        ORDINAL( "invoker.ordinal" );
 
         private final String key;
 
@@ -70,20 +73,20 @@ class InvokerProperties
             return key;
         }
     }
-    
+
     private enum SelectorProperty
     {
         JAVA_VERSION( ".java.version" ),
         MAVEN_VERSION( ".maven.version" ),
         OS_FAMLY( ".os.family" );
-        
+
         private final String suffix;
-        
+
         SelectorProperty( String suffix )
         {
             this.suffix = suffix;
         }
-        
+
         @Override
         public String toString()
         {
@@ -139,6 +142,7 @@ class InvokerProperties
 
     /**
      * Get the corresponding ordinal value
+     *
      * @return The ordinal value
      */
     public int getOrdinal()
@@ -163,8 +167,8 @@ class InvokerProperties
      */
     public String getJreVersion( int index )
     {
-        return this.properties.getProperty( SELECTOR_PREFIX + index + SelectorProperty.JAVA_VERSION.suffix,
-                                            getJreVersion() );
+        return this.properties.getProperty( SELECTOR_PREFIX + index + SelectorProperty.JAVA_VERSION,
+                getJreVersion() );
     }
 
     /**
@@ -177,17 +181,16 @@ class InvokerProperties
     {
         return this.properties.getProperty( "invoker.maven.version", "" );
     }
-    
+
     /**
-     * 
      * @param index the selector index
      * @return The specification of Maven versions on which this build job should be run.
      * @since 3.0.0
      */
     public String getMavenVersion( int index )
     {
-        return this.properties.getProperty( SELECTOR_PREFIX + index + SelectorProperty.MAVEN_VERSION.suffix,
-                                            getMavenVersion() );
+        return this.properties.getProperty( SELECTOR_PREFIX + index + SelectorProperty.MAVEN_VERSION,
+                getMavenVersion() );
     }
 
     /**
@@ -199,7 +202,7 @@ class InvokerProperties
     {
         return this.properties.getProperty( "invoker.os.family", "" );
     }
-    
+
     /**
      * Gets the specification of OS families on which this build job should be run.
      *
@@ -209,18 +212,17 @@ class InvokerProperties
      */
     public String getOsFamily( int index )
     {
-        return this.properties.getProperty( SELECTOR_PREFIX + index + SelectorProperty.OS_FAMLY.suffix,
-                                            getOsFamily() );
+        return this.properties.getProperty( SELECTOR_PREFIX + index + SelectorProperty.OS_FAMLY, getOsFamily() );
     }
-    
+
     public Collection<InvokerToolchain> getToolchains()
     {
-        return getToolchains( Pattern.compile( "invoker\\.toolchain\\.([^\\.]+)\\.(.+)" ) );
+        return getToolchains( Pattern.compile( "invoker\\.toolchain\\.([^.]+)\\.(.+)" ) );
     }
 
     public Collection<InvokerToolchain> getToolchains( int index )
     {
-        return getToolchains( Pattern.compile( "selector\\." + index + "\\.invoker\\.toolchain\\.([^\\.]+)\\.(.+)" ) );
+        return getToolchains( Pattern.compile( "selector\\." + index + "\\.invoker\\.toolchain\\.([^.]+)\\.(.+)" ) );
     }
 
     private Collection<InvokerToolchain> getToolchains( Pattern p )
@@ -248,6 +250,43 @@ class InvokerProperties
     }
 
     /**
+     * Extract environment variable from properties for given index.
+     * Every environment variable without index is also returned.
+     *
+     * @param index index to lookup
+     * @return map of environment name and value
+     */
+
+    private Map<String, String> getEnvironmentVariables( int index )
+    {
+
+        Map<String, String> envItems = new HashMap<>();
+
+        for ( Map.Entry<Object, Object> entry : properties.entrySet() )
+        {
+            Matcher matcher = ENVIRONMENT_VARIABLES_PATTERN.matcher( entry.getKey().toString() );
+            if ( matcher.matches() )
+            {
+
+                if ( String.valueOf( index ).equals( matcher.group( 3 ) ) )
+                {
+                    // variables with index has higher priority, so override
+                    envItems.put( matcher.group( 1 ), entry.getValue().toString() );
+                }
+                else if ( matcher.group( 3 ) == null )
+                {
+                    // variables without index has lower priority, so check if exist
+                    if ( !envItems.containsKey( matcher.group( 1 ) ) )
+                    {
+                        envItems.put( matcher.group( 1 ), entry.getValue().toString() );
+                    }
+                }
+            }
+        }
+        return envItems;
+    }
+
+    /**
      * Determines whether these invoker properties contain a build definition for the specified invocation index.
      *
      * @param index The one-based index of the invocation to check for, must not be negative.
@@ -264,10 +303,10 @@ class InvokerProperties
         }
         return false;
     }
-    
+
     /**
      * Determines whether these invoker properties contain a build definition for the specified selector index.
-     * 
+     *
      * @param index the index
      * @return <code>true</code> if the selector with the specified index is defined, <code>false</code> otherwise.
      * @since 3.0.0
@@ -341,19 +380,24 @@ class InvokerProperties
         String nonRecursive = get( InvocationProperty.NON_RECURSIVE, index );
         if ( nonRecursive != null )
         {
-            request.setRecursive( !Boolean.valueOf( nonRecursive ) );
+            request.setRecursive( !Boolean.parseBoolean( nonRecursive ) );
         }
 
         String offline = get( InvocationProperty.OFFLINE, index );
         if ( offline != null )
         {
-            request.setOffline( Boolean.valueOf( offline ) );
+            request.setOffline( Boolean.parseBoolean( offline ) );
         }
 
         String debug = get( InvocationProperty.DEBUG, index );
         if ( debug != null )
         {
-            request.setDebug( Boolean.valueOf( debug ) );
+            request.setDebug( Boolean.parseBoolean( debug ) );
+        }
+
+        for ( Map.Entry<String, String> envItem : getEnvironmentVariables( index ).entrySet() )
+        {
+            request.addShellEnvironment( envItem.getKey(), envItem.getValue() );
         }
     }
 
diff --git a/src/test/java/org/apache/maven/plugins/invoker/InvokerPropertiesTest.java b/src/test/java/org/apache/maven/plugins/invoker/InvokerPropertiesTest.java
index fe9349c..f4aebb0 100644
--- a/src/test/java/org/apache/maven/plugins/invoker/InvokerPropertiesTest.java
+++ b/src/test/java/org/apache/maven/plugins/invoker/InvokerPropertiesTest.java
@@ -309,6 +309,44 @@ public class InvokerPropertiesTest
     }
 
     @Test
+    public void testConfigureEnvironmentVariables() throws Exception
+    {
+        Properties props = new Properties();
+        InvokerProperties facade = new InvokerProperties( props );
+
+        props.setProperty( "invoker.abcdef", "abcdf" );
+        props.setProperty( "invoker.environmentVariables.KEY1.1", "value1.1" );
+        props.setProperty( "invoker.environmentVariables.KEY1", "value1" );
+        props.setProperty( "invoker.environmentVariables.KEY2", "value2" );
+        props.setProperty( "invoker.environmentVariables.KEY2.1", "value2.1" );
+        props.setProperty( "invoker.environmentVariables.KEY3", "value3" );
+        facade.configureInvocation( request, 0 );
+        verify( request ).addShellEnvironment( "KEY1", "value1" );
+        verify( request ).addShellEnvironment( "KEY2", "value2" );
+        verify( request ).addShellEnvironment( "KEY3", "value3" );
+        verifyNoMoreInteractions( request );
+    }
+
+    @Test
+    public void testConfigureEnvironmentVariablesWithIndex() throws Exception
+    {
+        Properties props = new Properties();
+        InvokerProperties facade = new InvokerProperties( props );
+
+        props.setProperty( "invoker.abcdef", "abcdf" );
+        props.setProperty( "invoker.environmentVariables.KEY1.1", "value1.1" );
+        props.setProperty( "invoker.environmentVariables.KEY1", "value1" );
+        props.setProperty( "invoker.environmentVariables.KEY2", "value2" );
+        props.setProperty( "invoker.environmentVariables.KEY2.1", "value2.1" );
+        props.setProperty( "invoker.environmentVariables.KEY3", "value3" );
+        facade.configureInvocation( request, 1 );
+        verify( request ).addShellEnvironment( "KEY1", "value1.1" );
+        verify( request ).addShellEnvironment( "KEY2", "value2.1" );
+        verify( request ).addShellEnvironment( "KEY3", "value3" );
+        verifyNoMoreInteractions( request );
+    }
+
+    @Test
     public void testIsInvocationDefined() throws Exception
     {
         Properties props = new Properties();
@@ -382,8 +420,8 @@ public class InvokerPropertiesTest
         assertNotNull( toolchains );
         assertEquals( 1, toolchains.size() );
         InvokerToolchain toolchain = toolchains.iterator().next();
-        assertEquals( "jdk", toolchain.getType());
-        assertEquals( Collections.singletonMap( "version", "11" ), toolchain.getProvides());
+        assertEquals( "jdk", toolchain.getType() );
+        assertEquals( Collections.singletonMap( "version", "11" ), toolchain.getProvides() );
     }
 
     @Test
@@ -394,12 +432,12 @@ public class InvokerPropertiesTest
         props.put( "selector.1.invoker.toolchain.jdk.version", "11" );
         InvokerProperties facade = new InvokerProperties( props );
 
-        Collection<InvokerToolchain> toolchains = facade.getToolchains(1);
+        Collection<InvokerToolchain> toolchains = facade.getToolchains( 1 );
         assertNotNull( toolchains );
         assertEquals( 1, toolchains.size() );
         InvokerToolchain toolchain = toolchains.iterator().next();
-        assertEquals( "jdk", toolchain.getType());
-        assertEquals( Collections.singletonMap( "version", "11" ), toolchain.getProvides());
+        assertEquals( "jdk", toolchain.getType() );
+        assertEquals( Collections.singletonMap( "version", "11" ), toolchain.getProvides() );
     }
 
 }


[maven-invoker-plugin] 01/04: update possible and easy dependencies

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MINVOKER-255
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit 1e9be47dce6d0772910b5410363074ddf4d5d61c
Author: Slawomir Jaranowski <s....@gmail.com>
AuthorDate: Mon Feb 17 18:19:43 2020 +0100

    update possible and easy dependencies
---
 pom.xml | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/pom.xml b/pom.xml
index 7fe4673..b3a7c43 100644
--- a/pom.xml
+++ b/pom.xml
@@ -192,7 +192,7 @@ under the License.
     <dependency>
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
-      <version>2.5</version>
+      <version>2.6</version>
     </dependency>
     <dependency>
       <groupId>org.codehaus.plexus</groupId>
@@ -223,13 +223,13 @@ under the License.
     <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <version>4.12</version>
+      <version>4.13</version>
       <scope>test</scope>
     </dependency>
     <dependency>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-core</artifactId>
-      <version>2.23.4</version>
+      <version>2.28.2</version>
       <scope>test</scope>
     </dependency>
     <dependency>
@@ -241,7 +241,7 @@ under the License.
     <dependency>
       <groupId>org.apache.maven</groupId>
       <artifactId>maven-compat</artifactId>
-      <version>3.0</version>
+      <version>${mavenVersion}</version>
       <scope>test</scope>
     </dependency>
     
@@ -323,7 +323,7 @@ under the License.
             <plugin>
               <groupId>org.apache.maven.plugins</groupId>
               <artifactId>maven-invoker-plugin</artifactId>
-              <version>3.2.0</version>
+              <version>3.2.1</version>
               <configuration>
                 <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                 <preBuildHookScript>setup</preBuildHookScript>
@@ -388,6 +388,7 @@ under the License.
       </build>
     </profile>
     <profile>
+      <id>bytecode-check</id>
       <activation>
         <jdk>[1.7,)</jdk>
       </activation>


[maven-invoker-plugin] 02/04: improve InvokerPropertiesTest

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MINVOKER-255
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit 5e74e4fed43c352993267cc361aa878112bd7957
Author: Slawomir Jaranowski <s....@gmail.com>
AuthorDate: Mon Feb 17 18:38:20 2020 +0100

    improve InvokerPropertiesTest
---
 .../plugins/invoker/InvokerPropertiesTest.java     | 302 ++++++++++++++-------
 1 file changed, 199 insertions(+), 103 deletions(-)

diff --git a/src/test/java/org/apache/maven/plugins/invoker/InvokerPropertiesTest.java b/src/test/java/org/apache/maven/plugins/invoker/InvokerPropertiesTest.java
index a492168..fe9349c 100644
--- a/src/test/java/org/apache/maven/plugins/invoker/InvokerPropertiesTest.java
+++ b/src/test/java/org/apache/maven/plugins/invoker/InvokerPropertiesTest.java
@@ -21,33 +21,50 @@ package org.apache.maven.plugins.invoker;
 
 import java.io.File;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Properties;
 
-import org.apache.maven.shared.invoker.DefaultInvocationRequest;
 import org.apache.maven.shared.invoker.InvocationRequest;
 import org.apache.maven.shared.invoker.InvocationRequest.ReactorFailureBehavior;
-
-import junit.framework.TestCase;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.clearInvocations;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoMoreInteractions;
+import static org.mockito.Mockito.verifyZeroInteractions;
+import static org.mockito.Mockito.when;
 
 /**
  * Tests the invoker properties facade.
  *
  * @author Benjamin Bentmann
  */
+@RunWith( MockitoJUnitRunner.class )
 public class InvokerPropertiesTest
-    extends TestCase
 {
 
+    @Mock
+    private InvocationRequest request;
+
+    @Test
     public void testConstructorNullSafe()
-        throws Exception
     {
         InvokerProperties facade = new InvokerProperties( null );
         assertNotNull( facade.getProperties() );
     }
 
+    @Test
     public void testGetInvokerProperty()
-        throws Exception
     {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties( props );
@@ -62,8 +79,8 @@ public class InvokerPropertiesTest
         assertEquals( "value", facade.get( "key", 2 ) );
     }
 
+    @Test
     public void testGetJobName()
-        throws Exception
     {
         Properties props = new Properties();
         final String jobName = "Build Job name";
@@ -73,8 +90,8 @@ public class InvokerPropertiesTest
         assertEquals( jobName, facade.getJobName() );
     }
 
-    public void testIsExpectedResult()
-        throws Exception
+    @Test
+    public void testIsExpectedResult() throws Exception
     {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties( props );
@@ -91,179 +108,208 @@ public class InvokerPropertiesTest
         assertTrue( facade.isExpectedResult( 1, 0 ) );
     }
 
-    public void testConfigureRequestGoals()
-        throws Exception
+    @Test
+    public void testConfigureRequestEmptyProperties()
     {
-        Properties props = new Properties();
-        InvokerProperties facade = new InvokerProperties( props );
 
-        InvocationRequest request = new DefaultInvocationRequest();
+        InvokerProperties facade = new InvokerProperties( null );
 
-        request.setGoals( Collections.singletonList( "test" ) );
         facade.configureInvocation( request, 0 );
-        assertEquals( Collections.singletonList( "test" ), request.getGoals() );
+        verifyZeroInteractions( request );
+    }
+
+    @Test
+    public void testConfigureRequestGoals() throws Exception
+    {
+        Properties props = new Properties();
+        InvokerProperties facade = new InvokerProperties( props );
 
         props.setProperty( "invoker.goals", "verify" );
         facade.configureInvocation( request, 0 );
-        assertEquals( Collections.singletonList( "verify" ), request.getGoals() );
+        verify( request ).setGoals( eq( Collections.singletonList( "verify" ) ) );
+        verifyNoMoreInteractions( request );
+        clearInvocations( request );
 
         props.setProperty( "invoker.goals", "   " );
         facade.configureInvocation( request, 0 );
-        assertEquals( Arrays.asList( new String[0] ), request.getGoals() );
+        verify( request ).setGoals( eq( Collections.<String>emptyList() ) );
+        verifyNoMoreInteractions( request );
+        clearInvocations( request );
 
-        props.setProperty( "invoker.goals", "  clean , test   verify  " );
+        props.setProperty( "invoker.goals", "" );
         facade.configureInvocation( request, 0 );
-        assertEquals( Arrays.asList( new String[] { "clean", "test", "verify" } ), request.getGoals() );
+        verify( request ).setGoals( eq( Collections.<String>emptyList() ) );
+        verifyNoMoreInteractions( request );
+        clearInvocations( request );
 
-        props.setProperty( "invoker.goals", "" );
+        props.setProperty( "invoker.goals", "  clean , test   verify " );
         facade.configureInvocation( request, 0 );
-        assertEquals( Arrays.asList( new String[0] ), request.getGoals() );
+        verify( request ).setGoals( eq( Arrays.asList( "clean", "test", "verify" ) ) );
+        verifyNoMoreInteractions( request );
     }
 
-    public void testConfigureRequestProfiles()
-        throws Exception
+    @Test
+    public void testConfigureRequestProfiles() throws Exception
     {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties( props );
 
-        InvocationRequest request = new DefaultInvocationRequest();
-
-        request.setProfiles( Collections.singletonList( "test" ) );
-        facade.configureInvocation( request, 0 );
-        assertEquals( Collections.singletonList( "test" ), request.getProfiles() );
-
         props.setProperty( "invoker.profiles", "verify" );
         facade.configureInvocation( request, 0 );
-        assertEquals( Collections.singletonList( "verify" ), request.getProfiles() );
+        verify( request ).setProfiles( eq( Collections.singletonList( "verify" ) ) );
+        verifyNoMoreInteractions( request );
+        clearInvocations( request );
 
         props.setProperty( "invoker.profiles", "   " );
         facade.configureInvocation( request, 0 );
-        assertEquals( Arrays.asList( new String[0] ), request.getProfiles() );
+        verify( request ).setProfiles( eq( Collections.<String>emptyList() ) );
+        verifyNoMoreInteractions( request );
+        clearInvocations( request );
 
-        props.setProperty( "invoker.profiles", "  clean , test   verify  ," );
+        props.setProperty( "invoker.profiles", "" );
         facade.configureInvocation( request, 0 );
-        assertEquals( Arrays.asList( new String[] { "clean", "test", "verify" } ), request.getProfiles() );
+        verify( request ).setProfiles( eq( Collections.<String>emptyList() ) );
+        verifyNoMoreInteractions( request );
+        clearInvocations( request );
 
-        props.setProperty( "invoker.profiles", "" );
+        props.setProperty( "invoker.profiles", "  clean , test   verify  ," );
         facade.configureInvocation( request, 0 );
-        assertEquals( Arrays.asList( new String[0] ), request.getProfiles() );
+        verify( request ).setProfiles( eq( Arrays.asList( "clean", "test", "verify" ) ) );
+        verifyNoMoreInteractions( request );
     }
 
-    public void testConfigureRequestProject()
-        throws Exception
+    @Test
+    public void testConfigureRequestProject() throws Exception
     {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties( props );
 
-        InvocationRequest request = new DefaultInvocationRequest();
-
         File tempPom = File.createTempFile( "maven-invoker-plugin-test", ".pom" );
-        File tempDir = tempPom.getParentFile();
-
-        request.setBaseDirectory( tempDir );
-        facade.configureInvocation( request, 0 );
-        assertEquals( tempDir, request.getBaseDirectory() );
-        assertEquals( null, request.getPomFile() );
-
-        props.setProperty( "invoker.project", tempPom.getName() );
-        request.setBaseDirectory( tempDir );
-        facade.configureInvocation( request, 0 );
-        assertEquals( tempDir, request.getBaseDirectory() );
-        assertEquals( tempPom, request.getPomFile() );
-
-        props.setProperty( "invoker.project", "" );
-        request.setBaseDirectory( tempDir );
-        facade.configureInvocation( request, 0 );
-        assertEquals( tempDir, request.getBaseDirectory() );
-        assertEquals( null, request.getPomFile() );
-
-        tempPom.delete();
+        try
+        {
+            File tempDir = tempPom.getParentFile();
+            when( request.getBaseDirectory() ).thenReturn( tempDir );
+
+            props.setProperty( "invoker.project", tempPom.getName() );
+            facade.configureInvocation( request, 0 );
+            verify( request ).getBaseDirectory();
+            verify( request ).setBaseDirectory( eq( tempDir ) );
+            verify( request ).setPomFile( eq( tempPom ) );
+            verifyNoMoreInteractions( request );
+            clearInvocations( request );
+
+            props.setProperty( "invoker.project", "" );
+            facade.configureInvocation( request, 0 );
+            verify( request ).getBaseDirectory();
+            verify( request ).setBaseDirectory( eq( tempDir ) );
+            verify( request ).setPomFile( null );
+            verifyNoMoreInteractions( request );
+        }
+        finally
+        {
+            tempPom.delete();
+        }
     }
 
+    @Test
     public void testConfigureRequestMavenOpts()
-        throws Exception
     {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties( props );
 
-        InvocationRequest request = new DefaultInvocationRequest();
-
-        request.setMavenOpts( "default" );
-        facade.configureInvocation( request, 0 );
-        assertEquals( "default", request.getMavenOpts() );
-
         props.setProperty( "invoker.mavenOpts", "-Xmx512m" );
         facade.configureInvocation( request, 0 );
-        assertEquals( "-Xmx512m", request.getMavenOpts() );
+        verify( request ).setMavenOpts( "-Xmx512m" );
+        verifyNoMoreInteractions( request );
     }
 
-    public void testConfigureRequestFailureBehavior()
-        throws Exception
+    @Test
+    public void testConfigureRequestFailureBehavior() throws Exception
     {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties( props );
 
-        InvocationRequest request = new DefaultInvocationRequest();
-
-        request.setReactorFailureBehavior( ReactorFailureBehavior.FailAtEnd );
-        facade.configureInvocation( request, 0 );
-        assertEquals( ReactorFailureBehavior.FailAtEnd, request.getReactorFailureBehavior() );
-
         props.setProperty( "invoker.failureBehavior", ReactorFailureBehavior.FailNever.getLongOption() );
         facade.configureInvocation( request, 0 );
-        assertEquals( "fail-never", request.getReactorFailureBehavior().getLongOption() );
+        verify( request ).setReactorFailureBehavior( eq( ReactorFailureBehavior.FailNever ) );
+        verifyNoMoreInteractions( request );
     }
 
-    public void testConfigureRequestRecursion()
-        throws Exception
+    @Test
+    public void testConfigureRequestFailureBehaviorUnKnownName() throws Exception
     {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties( props );
 
-        InvocationRequest request = new DefaultInvocationRequest();
+        props.setProperty( "invoker.failureBehavior", "xxxUnKnown" );
+        try
+        {
+            facade.configureInvocation( request, 0 );
+        }
+        catch ( IllegalArgumentException e )
+        {
+            assertEquals( "The string 'xxxUnKnown' can not be converted to enumeration.", e.getMessage() );
+        }
+        verifyZeroInteractions( request );
+    }
 
-        request.setRecursive( true );
-        facade.configureInvocation( request, 0 );
-        assertTrue( request.isRecursive() );
-        request.setRecursive( false );
-        facade.configureInvocation( request, 0 );
-        assertFalse( request.isRecursive() );
+
+    @Test
+    public void testConfigureRequestRecursion() throws Exception
+    {
+        Properties props = new Properties();
+        InvokerProperties facade = new InvokerProperties( props );
 
         props.setProperty( "invoker.nonRecursive", "true" );
         facade.configureInvocation( request, 0 );
-        assertFalse( request.isRecursive() );
+        verify( request ).setRecursive( false );
+        verifyNoMoreInteractions( request );
+        clearInvocations( request );
 
         props.setProperty( "invoker.nonRecursive", "false" );
         facade.configureInvocation( request, 0 );
-        assertTrue( request.isRecursive() );
+        verify( request ).setRecursive( true );
+        verifyNoMoreInteractions( request );
     }
 
-    public void testConfigureRequestOffline()
-        throws Exception
+    @Test
+    public void testConfigureRequestOffline() throws Exception
     {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties( props );
 
-        InvocationRequest request = new DefaultInvocationRequest();
-
-        request.setOffline( true );
+        props.setProperty( "invoker.offline", "true" );
         facade.configureInvocation( request, 0 );
-        assertTrue( request.isOffline() );
-        request.setOffline( false );
+        verify( request ).setOffline( true );
+        verifyNoMoreInteractions( request );
+        clearInvocations( request );
+
+        props.setProperty( "invoker.offline", "false" );
         facade.configureInvocation( request, 0 );
-        assertFalse( request.isOffline() );
+        verify( request ).setOffline( false );
+        verifyNoMoreInteractions( request );
+    }
 
-        props.setProperty( "invoker.offline", "true" );
+    @Test
+    public void testConfigureRequestDebug() throws Exception
+    {
+        Properties props = new Properties();
+        InvokerProperties facade = new InvokerProperties( props );
+
+        props.setProperty( "invoker.debug", "true" );
         facade.configureInvocation( request, 0 );
-        assertTrue( request.isOffline() );
+        verify( request ).setDebug( true );
+        verifyNoMoreInteractions( request );
+        clearInvocations( request );
 
-        props.setProperty( "invoker.offline", "false" );
+        props.setProperty( "invoker.debug", "false" );
         facade.configureInvocation( request, 0 );
-        assertFalse( request.isOffline() );
+        verify( request ).setDebug( false );
+        verifyNoMoreInteractions( request );
     }
 
-    public void testIsInvocationDefined()
-        throws Exception
+    @Test
+    public void testIsInvocationDefined() throws Exception
     {
         Properties props = new Properties();
         InvokerProperties facade = new InvokerProperties( props );
@@ -284,7 +330,8 @@ public class InvokerPropertiesTest
         assertTrue( facade.isInvocationDefined( 3 ) );
         assertFalse( facade.isInvocationDefined( 4 ) );
     }
-    
+
+    @Test
     public void testIsSelectedDefined()
     {
         Properties props = new Properties();
@@ -306,4 +353,53 @@ public class InvokerPropertiesTest
         assertTrue( facade.isSelectorDefined( 4 ) );
         assertFalse( facade.isSelectorDefined( 5 ) );
     }
+
+    @Test
+    public void testGetToolchainsForEmptyProperties()
+    {
+
+        Properties props = new Properties();
+        InvokerProperties facade = new InvokerProperties( props );
+
+        Collection<InvokerToolchain> toolchains = facade.getToolchains();
+        assertNotNull( toolchains );
+        assertEquals( 0, toolchains.size() );
+
+        toolchains = facade.getToolchains( 1 );
+        assertNotNull( toolchains );
+        assertEquals( 0, toolchains.size() );
+    }
+
+    @Test
+    public void testGetToolchains()
+    {
+
+        Properties props = new Properties();
+        props.put( "invoker.toolchain.jdk.version", "11" );
+        InvokerProperties facade = new InvokerProperties( props );
+
+        Collection<InvokerToolchain> toolchains = facade.getToolchains();
+        assertNotNull( toolchains );
+        assertEquals( 1, toolchains.size() );
+        InvokerToolchain toolchain = toolchains.iterator().next();
+        assertEquals( "jdk", toolchain.getType());
+        assertEquals( Collections.singletonMap( "version", "11" ), toolchain.getProvides());
+    }
+
+    @Test
+    public void testGetToolchainsWithIndex()
+    {
+
+        Properties props = new Properties();
+        props.put( "selector.1.invoker.toolchain.jdk.version", "11" );
+        InvokerProperties facade = new InvokerProperties( props );
+
+        Collection<InvokerToolchain> toolchains = facade.getToolchains(1);
+        assertNotNull( toolchains );
+        assertEquals( 1, toolchains.size() );
+        InvokerToolchain toolchain = toolchains.iterator().next();
+        assertEquals( "jdk", toolchain.getType());
+        assertEquals( Collections.singletonMap( "version", "11" ), toolchain.getProvides());
+    }
+
 }


[maven-invoker-plugin] 04/04: remove duplicate IT test

Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

slachiewicz pushed a commit to branch MINVOKER-255
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit 2ea4b0e90d631c444c4eb6d37e48c015d934e340
Author: Slawomir Jaranowski <s....@gmail.com>
AuthorDate: Mon Feb 17 19:15:47 2020 +0100

    remove duplicate IT test
---
 src/it/multiEnvVar/pom.xml                         | 70 ----------------------
 .../multiEnvVar/src/it/project/invoker.properties  | 19 ------
 src/it/multiEnvVar/src/it/project/pom.xml          | 62 -------------------
 3 files changed, 151 deletions(-)

diff --git a/src/it/multiEnvVar/pom.xml b/src/it/multiEnvVar/pom.xml
deleted file mode 100644
index b34d142..0000000
--- a/src/it/multiEnvVar/pom.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?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.its</groupId>
-  <artifactId>maven-env-test</artifactId>
-  <version>0.1-SNAPSHOT</version>
-  <name>Maven Environment Test</name>
-  <description>Maven Invoker tests for environment variable setting</description>
-
-  <url>https://issues.apache.org/jira/browse/MINVOKER-155</url>
-  
-  <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>@project.version@</version>
-        <configuration>
-          <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
-          <postBuildHookScript>verify</postBuildHookScript>
-          <properties>
-            <!-- e.g. ensure that Java7 picks up TLSv1.2 when connecting with Central -->
-            <https.protocols>${https.protocols}</https.protocols>
-          </properties>
-        </configuration>
-        <executions>
-          <execution>
-            <phase>initialize</phase>
-            <goals>
-              <goal>install</goal>
-              <goal>run</goal>
-            </goals>
-            <configuration>
-              <environmentVariables>
-                <A_PROP>white</A_PROP>
-                <Z_PROP>blue</Z_PROP>
-              </environmentVariables>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-</project>
diff --git a/src/it/multiEnvVar/src/it/project/invoker.properties b/src/it/multiEnvVar/src/it/project/invoker.properties
deleted file mode 100644
index 970ae39..0000000
--- a/src/it/multiEnvVar/src/it/project/invoker.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-# 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.name=Multiple env props
-invoker.goals=process-sources
diff --git a/src/it/multiEnvVar/src/it/project/pom.xml b/src/it/multiEnvVar/src/it/project/pom.xml
deleted file mode 100644
index f2455e9..0000000
--- a/src/it/multiEnvVar/src/it/project/pom.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?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.invoker.its.it</groupId>
-  <artifactId>multEnvVar</artifactId>
-  <version>0.1-SNAPSHOT</version>
-  <packaging>pom</packaging>
-
-  <build>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-enforcer-plugin</artifactId>
-        <version>1.2</version>
-        <executions>
-          <execution>
-            <id>enforce-env-properties</id>
-            <phase>process-sources</phase>
-            <goals>
-              <goal>enforce</goal>
-            </goals>
-            <configuration>
-              <rules>
-                <requireProperty>
-                  <property>env.A_PROP</property>
-                  <message>### Missing property 'A_PROP'</message>
-                </requireProperty>
-                <requireProperty>
-                  <property>env.Z_PROP</property>
-                  <message>### Missing property 'Z_PROP'</message>
-                </requireProperty>
-              </rules>
-            </configuration>
-          </execution>
-        </executions>
-      </plugin>
-    </plugins>
-  </build>
-
-</project>