You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2017/12/20 09:36:07 UTC

[maven-invoker-plugin] annotated tag maven-invoker-plugin-1.1 created (now 50bc4cc)

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

hboutemy pushed a change to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git.


      at 50bc4cc  (tag)
 tagging 0a96498c413f2c422653cd88adc50eafed8a4a85 (commit)
      by Oliver Lamy
      on Mon Dec 17 09:02:55 2007 +0000

- Log -----------------------------------------------------------------
maven-invoker-plugin-1.1
-----------------------------------------------------------------------

This annotated tag includes the following new commits:

     new 840fd36  Initial pass at a maven-forking plugin...uses the maven-invoker API from maven/shared.
     new 9545d35  changing pom to use new parent, and added sysout/syserr handling for scripts.
     new 6f921e1  Adding ability to specify a single POM to build as an override to the scanning behavior.
     new 444329b  Cleaning up output and fixing single-pom override parameter.
     new b866164  Adding SCM info for the sandbox location.
     new c3d96d3  ...and fixing SCM info for the sandbox location.
     new c9d8e23  Adding option to stream build logs to the mojo output.
     new f7bd57a  Changing verification script to be more general-purpose, as a post-build hook.
     new 610c654  MNG-2587: [maven-invoker-plugin] build.log file should not be placed inside the target/ directory
     new 1c9e4c3  Updating the parent-pom version.
     new c56c0d1  moved to sandbox
     new b6b9d9c  o starting site for invoker plugin
     new 694825a  o adding a faq
     new 59931b9  o adding documentation for the invoker plugin
     new 6104c1c  o inherit the SCM element
     new 7f5f4d0  o adding prereq
     new 59a22b7  Adding parameters to suppress summary and inject global test properties for all IT builds.
     new 65bf500  o updating to latest released parent
     new b505fe0  - move plugin-plugin out of 'reporting' for plugins. It's a required part of the site, and does not cause any issues with the reactor or site generation - update to snapshots
     new 76b2d9b  o rolling back some snapshots to releases to prepare for a release, the vote was in october so we'll need to do it again, but this is necessary for automating some non-standard builds for the ITs
     new 886d6fa  o correctly reference
     new d7f13fd  o udating the license headers
     new 873778c  o fix reference
     new 8f6160c  Fixing for released maven-invoker, and rolling back the parent pom version to avoid having to release it.
     new 9562738  [maven-release-plugin] prepare release maven-invoker-plugin-1.0
     new 74ce6fe  [maven-release-plugin] prepare for next development iteration
     new efbb386  update parent
     new 3fb23d1  Update parent version to 8, as 8-SNAPSHOT is never deployed and 8 is released
     new 2dfe24f  Adding ability to clone the project(s) before invoking. This is useful when you actually want to run the main build twice (once nested within the other) without having any collisions on class output dir, etc.
     new 560f696  [MINVOKER-2] Applying patch to keep failures from being counted twice.
     new 82a089c  Adding support for profiles.
     new 6c985d8  Adding skip flag to enable fine-grained control over existing plugin configurations from within a profile, simply by setting a flag.
     new 04441c3  add some @since
     new 4fe6579  add unit test
     new d31626a  remove System.out.println
     new 14816a5  [MINVOKER-9] Interpolate goal files with project and new properties field
     new 643d8d5  [MINVOKER-11] In case of error in bsh evaluation the error must be display this error is displayed with getLog().error in the mojo
     new a174e86  add a documentation on goals files interpolation
     new c4eb8bb  [MINVOKER-12] Interpolate it pom with a different token ${..} -> @...@
     new fa99c3d  [MINVOKER-13] support a parameter "a la" -Dtest like in surefire
     new ed67926  use deleteOnExit() for temporary interpolated  pom files
     new 4e8b8f6  [MINVOKER-15] fix issueManagement url
     new 2644771  [MINVOKER-10] Capability to define different profiles per it test
     new ce15826  [MINVOKER-20] Adding properties parameter to replace testProperties, and use the more standard <key>value</key> syntax for properties.
     new 0a96498  [maven-release-plugin]  copy for tag maven-invoker-plugin-1.1

The 45 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.


-- 
To stop receiving notification emails like this one, please contact
['"commits@maven.apache.org" <co...@maven.apache.org>'].

[maven-invoker-plugin] 16/22: [MINVOKER-12] Interpolate it pom with a different token ${..} -> @...@

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

hboutemy pushed a commit to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit c4eb8bb8a70e31ff25e3c45be2f923309cf34b45
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Thu Nov 29 23:05:54 2007 +0000

    [MINVOKER-12] Interpolate it pom with a different token ${..} -> @...@
    
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin@599618 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/maven/plugin/invoker/InvokerMojo.java   | 119 ++++++++++++++++++---
 src/site/apt/advance-usage.apt                     |   9 +-
 .../maven/plugin/invoker/InterpolationTest.java    |  41 ++++++-
 src/test/resources/unit/interpolation/pom.xml      |  29 +++++
 4 files changed, 179 insertions(+), 19 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
index a5d1077..1fdfea5 100644
--- a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
@@ -23,6 +23,7 @@ import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileReader;
+import java.io.FileWriter;
 import java.io.IOException;
 import java.io.PrintStream;
 import java.util.ArrayList;
@@ -50,6 +51,7 @@ import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.InterpolationFilterReader;
 import org.codehaus.plexus.util.cli.CommandLineException;
+import org.codehaus.plexus.util.xml.XmlStreamReader;
 
 import bsh.EvalError;
 import bsh.Interpreter;
@@ -228,6 +230,9 @@ public class InvokerMojo
      * @since 1.1
      */
     private MavenProject project;    
+    
+    // list to store interpolated pom for delete at the end
+    private List/*File*/ interpolatedPomFiles = new ArrayList();
 
     public void execute()
         throws MojoExecutionException, MojoFailureException
@@ -294,11 +299,19 @@ public class InvokerMojo
 
         final List failures = new ArrayList();
 
-        for ( int i = 0; i < includedPoms.length; i++ )
+        try
         {
-            final String pom = includedPoms[i];
+            for ( int i = 0; i < includedPoms.length; i++ )
+            {
+                final String pom = includedPoms[i];
 
-            runBuild( projectsDir, pom, failures );
+                runBuild( projectsDir, pom, failures );
+            }
+        }
+        finally
+        {
+            // interpolated files cleanup
+            cleanupInterpolatedPomFiles();
         }
 
         if ( !suppressSummaries )
@@ -408,18 +421,17 @@ public class InvokerMojo
     private void runBuild( final File projectsDir, final String pom, final List failures )
         throws MojoExecutionException
     {
+        
         File pomFile = new File( projectsDir, pom );
-
         final File basedir = pomFile.getParentFile();
-
-        getLog().info( "Building: " + pom );
-
-        final File outputLog = new File( basedir, "build.log" );
-
+        File interpolatedPomFile = buildInterpolatedPomFile( pomFile, basedir );
         FileLogger logger = null;
-
         try
         {
+            getLog().info( "Building: " + pom );
+
+            final File outputLog = new File( basedir, "build.log" );
+
             if ( !noLog )
             {
                 outputLog.getParentFile().mkdirs();
@@ -448,7 +460,7 @@ public class InvokerMojo
                 }
             }
 
-            if ( !prebuild( basedir, pom, failures, logger ) )
+            if ( !prebuild( basedir, interpolatedPomFile, failures, logger ) )
             {
                 getLog().info( "...FAILED[pre-build script returned false]" );
 
@@ -529,8 +541,7 @@ public class InvokerMojo
                 request.setOutputHandler( logger );
             }
 
-            request.setPomFile( pomFile );
-
+            request.setPomFile( interpolatedPomFile );
             if ( profiles != null )
             {
                 request.setProfiles( profiles );
@@ -580,7 +591,7 @@ public class InvokerMojo
 
                 failures.add( pom );
             }
-            else if ( !verify( basedir, pom, failures, logger ) )
+            else if ( !verify( basedir, interpolatedPomFile, failures, logger ) )
             {
                 if ( !suppressSummaries )
                 {
@@ -589,7 +600,7 @@ public class InvokerMojo
 
                 failures.add( pom );
             }
-            else if (!suppressSummaries )
+            else if ( !suppressSummaries )
             {
                 getLog().info( "...SUCCESS." );
             }
@@ -632,7 +643,7 @@ public class InvokerMojo
         return testProps;
     }
 
-    private boolean verify( final File basedir, final String pom, final List failures, final FileLogger logger )
+    private boolean verify( final File basedir, final File pom, final List failures, final FileLogger logger )
     {
         boolean result = true;
 
@@ -715,7 +726,7 @@ public class InvokerMojo
         return scriptResult;
     }
 
-    private boolean prebuild( final File basedir, final String pom, final List failures, final FileLogger logger )
+    private boolean prebuild( final File basedir, final File pom, final List failures, final FileLogger logger )
     {
         boolean result = true;
 
@@ -904,5 +915,79 @@ public class InvokerMojo
 
         return result;
     }
+    
+    protected File buildInterpolatedPomFile( File pomFile, File targetDirectory )
+        throws MojoExecutionException
+    {
+        File interpolatedPomFile = new File( targetDirectory, "interpolated-pom.xml" );
+        interpolatedPomFiles.add( interpolatedPomFile );
+        Map composite = new CompositeMap( this.project, this.interpolationsProperties );
+
+        try
+        {
+            boolean created = interpolatedPomFile.createNewFile();
+            if ( !created )
+            {
+                throw new MojoExecutionException( "fail to create file " + interpolatedPomFile.getPath() );
+            }
+        }
+        catch ( IOException e )
+        {
+            throw new MojoExecutionException( "fail to create file " + interpolatedPomFile.getPath() );
+        }
+        getLog().debug( "interpolate it pom to create interpolated in " + interpolatedPomFile.getPath() );
+
+        BufferedReader reader = null;
+        FileWriter fileWriter = null;
+        try
+        {
+            // pom interpolation with token @...@
+            reader = new BufferedReader( new InterpolationFilterReader( new XmlStreamReader( pomFile ), composite, "@",
+                                                                        "@" ) );
+            fileWriter = new FileWriter( interpolatedPomFile );
+            String line = null;
+            while ( ( line = reader.readLine() ) != null )
+            {
+                fileWriter.write( line );
+            }
+            fileWriter.flush();
+        }
+        catch ( IOException e )
+        {
+            String message = "error when interpolating it pom";
+            throw new MojoExecutionException( message, e );
+        }
+        finally
+        {
+            // IOUtil in p-u is null check and silently NPE
+            IOUtil.close( reader );
+            IOUtil.close( fileWriter );
+        }
+
+        if ( interpolatedPomFile == null )
+        {
+            // null check : normally impossibe but :-)
+            throw new MojoExecutionException( "pom file is null after interpolation" );
+        }
+        return interpolatedPomFile;
+    }
+    
+    private void cleanupInterpolatedPomFiles()
+    {
+        for ( Iterator iterator = this.interpolatedPomFiles.iterator(); iterator.hasNext(); )
+        {
+            File file = (File) iterator.next();
+            if ( file.exists() )
+            {
+                try
+                {
+                FileUtils.forceDelete( file );
+                } catch (IOException e)
+                {
+                    getLog().warn( "fail to clean file " + file.getPath() );
+                }
+            }
+        }
+    }
 
 }
diff --git a/src/site/apt/advance-usage.apt b/src/site/apt/advance-usage.apt
index 5a77453..33e33c9 100755
--- a/src/site/apt/advance-usage.apt
+++ b/src/site/apt/advance-usage.apt
@@ -12,10 +12,17 @@ Advance Usage
 
   goals files can be interpolated with some values : 
   
-  * values from the project pom (you can use $\{pom.groupId} in your goals file)
+  * values from the project pom (you must use $\{pom.groupId} notation in your goals file)
   
   * In the plugin configuration you can add some properties in a interpolationsProperties element
+
+* it Pom Interpolation 
+
+  It poms can be interpolated with some values : 
     
+  * values from the project pom (you must use @pom.groupId@ notation in your pom file)
+  
+  * In the plugin configuration you can add some properties in a interpolationsProperties element    
     
   
    
\ No newline at end of file
diff --git a/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java b/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java
index 0a4ec44..9fd8166 100755
--- a/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java
+++ b/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java
@@ -19,12 +19,14 @@
 package org.apache.maven.plugin.invoker;
 
 import java.io.File;
+import java.io.FileReader;
 import java.util.List;
 import java.util.Properties;
 
 import org.apache.maven.model.Scm;
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+import org.codehaus.plexus.util.IOUtil;
 
 /**
  * @author <a href="mailto:olamy@apache.org">olamy</a>
@@ -71,10 +73,47 @@ public class InterpolationTest
         properties.put( "cleanProps", "clean" );
         properties.put( "version", "2.0-SNAPSHOT" );
         setVariableValueToObject( invokerMojo, "interpolationsProperties", properties );
-        String dirPath = getBasedir() + "/src/test/resources/unit/interpolation/";
+        String dirPath = getBasedir() + File.separatorChar + "src" + File.separatorChar + "test"
+        + File.separatorChar + "resources" + File.separatorChar + "unit" + File.separatorChar + "interpolation";
         List goals = invokerMojo.getGoals( new File( dirPath ) );
         assertEquals( goals.toString(), 2, goals.size() );
         assertEquals( "clean", goals.get( 0 ) );
         assertEquals( "bar:foo:1.0-SNAPSHOT:mygoal", goals.get( 1 ) );
     }
+    
+    public void testPomInterpolation()
+        throws Exception
+    {
+        FileReader fileReader = null;
+        File interpolatedPomFile = null;
+        try
+        {
+            InvokerMojo invokerMojo = new InvokerMojo();
+            setVariableValueToObject( invokerMojo, "goalsFile", "goals.txt" );
+            setVariableValueToObject( invokerMojo, "project", buildMavenProjectStub() );
+            Properties properties = new Properties();
+            properties.put( "foo", "bar" );
+            properties.put( "version", "2.0-SNAPSHOT" );
+            setVariableValueToObject( invokerMojo, "interpolationsProperties", properties );
+            String dirPath = getBasedir() + File.separatorChar + "src" + File.separatorChar + "test"
+                + File.separatorChar + "resources" + File.separatorChar + "unit" + File.separatorChar + "interpolation";
+            interpolatedPomFile = invokerMojo.buildInterpolatedPomFile( new File( dirPath, "pom.xml" ),
+                                                                        new File( getBasedir() + File.separatorChar
+                                                                            + "target" ) );
+            fileReader = new FileReader( interpolatedPomFile );
+            String content = IOUtil.toString( fileReader );
+            assertTrue( content.indexOf( "<interpolateValue>bar</interpolateValue>" ) > 0 );
+        }
+        finally
+        {
+            if ( fileReader != null )
+            {
+                fileReader.close();
+            }
+            if ( interpolatedPomFile != null )
+            {
+                interpolatedPomFile.delete();
+            }
+        }
+    }
 }
diff --git a/src/test/resources/unit/interpolation/pom.xml b/src/test/resources/unit/interpolation/pom.xml
new file mode 100755
index 0000000..ab2014a
--- /dev/null
+++ b/src/test/resources/unit/interpolation/pom.xml
@@ -0,0 +1,29 @@
+<?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.test</groupId>
+  <artifactId>unit</artifactId>
+  <packaging>pom</packaging>
+  <version>0.1-SNAPSHOT</version>
+  <properties>
+    <interpolateValue>@foo@</interpolateValue>
+  </properties>
+</project>
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.

[maven-invoker-plugin] 03/22: [maven-release-plugin] prepare for next development iteration

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

hboutemy pushed a commit to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit 74ce6fe9a606ad62fea5c5f95a5496afdcf2e3a3
Author: John Dennis Casey <jd...@apache.org>
AuthorDate: Wed Jan 17 22:26:06 2007 +0000

    [maven-release-plugin] prepare for next development iteration
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin@497212 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/pom.xml b/pom.xml
index 6b3a762..dc3e7c9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
     <version>7</version>
   </parent>
   <artifactId>maven-invoker-plugin</artifactId>
-  <version>1.0</version>
+  <version>1.1-SNAPSHOT</version>
   <prerequisites>                                                                                                                                                      
     <maven>2.0</maven>                                                                                                                                                 
   </prerequisites>   
@@ -49,10 +49,4 @@
       <version>2.0b4</version>
     </dependency>
   </dependencies>
-
-  <scm>
-    <connection>scm:svn:https://svn.apache.org/repos/asf/maven/plugins/tags/maven-invoker-plugin-1.0</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/plugins/tags/maven-invoker-plugin-1.0</developerConnection>
-    <url>https://svn.apache.org/repos/asf/maven/plugins/tags/maven-invoker-plugin-1.0</url>
-  </scm>
 </project>
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.

[maven-invoker-plugin] 08/22: Adding support for profiles.

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

hboutemy pushed a commit to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit 82a089c950b65bdcb65f4dd68667cbf00e56e9ad
Author: John Dennis Casey <jd...@apache.org>
AuthorDate: Fri Sep 14 06:55:01 2007 +0000

    Adding support for profiles.
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin@575565 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            |   2 +-
 .../apache/maven/plugin/invoker/InvokerMojo.java   | 145 +++++++++++----------
 2 files changed, 79 insertions(+), 68 deletions(-)

diff --git a/pom.xml b/pom.xml
index 107de71..95169cd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -16,7 +16,7 @@
     <dependency>
       <groupId>org.apache.maven.shared</groupId>
       <artifactId>maven-invoker</artifactId>
-      <version>2.0.6</version>
+      <version>2.0.7-SNAPSHOT</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
diff --git a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
index ce530a5..e3da80a 100644
--- a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
@@ -54,9 +54,9 @@ import java.util.StringTokenizer;
 /**
  * Searches for integration test Maven projects, and executes each, collecting a log in the project directory, and
  * outputting the results to the screen.
- * 
+ *
  * @goal run
- * 
+ *
  * @author <a href="mailto:kenney@apache.org">Kenney Westerhof</a>
  * @author <a href="mailto:jdcasey@apache.org">John Casey</a>
  */
@@ -68,70 +68,70 @@ public class InvokerMojo
      * the only indication of the build's success or failure will be the effect it has on the main
      * build (if it fails, the main build should fail as well). If streamLogs is enabled, the sub-build
      * summary will also provide an indication. By default, this parameter is set to false.
-     * 
+     *
      * @parameter default-value="false"
      */
     private boolean suppressSummaries;
-    
+
     /**
      * Flag used to determine whether the build logs should be output to the normal mojo log.
-     * 
+     *
      * @parameter expression="${invoker.streamLogs}" default-value="false"
      */
     private boolean streamLogs;
-    
+
     /**
      * The local repository for caching artifacts.
-     * 
+     *
      * @parameter expression="${invoker.localRepositoryPath}"
      */
     private String localRepositoryPath;
 
     /**
      * Directory to search for integration tests.
-     * 
+     *
      * @parameter expression="${invoker.projectsDirectory}" default-value="${basedir}/src/projects/"
      */
     private File projectsDirectory;
-    
+
     /**
      * Directory to which projects should be cloned prior to execution.
-     * 
+     *
      * @parameter
      */
     private File cloneProjectsTo;
-    
+
     /**
      * A single POM to build, skipping any scanning parameters and behavior.
-     * 
+     *
      * @parameter expression="${invoker.pom}"
      */
     private File pom;
 
     /**
      * Includes for searching the integration test directory. This parameter is meant to be set from the POM.
-     * 
+     *
      * @parameter
      */
     private List pomIncludes = Collections.singletonList( "*/pom.xml" );
 
     /**
      * Excludes for searching the integration test directory. This parameter is meant to be set from the POM.
-     * 
+     *
      * @parameter
      */
     private List pomExcludes = Collections.EMPTY_LIST;
 
     /**
      * The comma-separated list of goals to execute on each project. Default is 'package'.
-     * 
+     *
      * @parameter
      */
     private List goals = Collections.singletonList( "package" );
 
     /**
      * The name of the project-specific file that contains the enumeration of goals to execute for that test.
-     * 
+     *
      * @parameter expression="${invoker.goalsFile}" default-value="goals.txt"
      */
     private String goalsFile;
@@ -143,53 +143,59 @@ public class InvokerMojo
 
     /**
      * relative path of a pre-build hook beanshell script to run prior to executing the build.
-     * 
+     *
      * @parameter expression="${invoker.preBuildHookScript}" default-value="prebuild.bsh"
      */
     private String preBuildHookScript;
 
     /**
      * relative path of a cleanup/verification beanshell script to run after executing the build.
-     * 
+     *
      * @parameter expression="${invoker.postBuildHookScript}" default-value="postbuild.bsh"
      */
     private String postBuildHookScript;
 
     /**
      * Location of a properties file that defines CLI properties for the test.
-     * 
+     *
      * @parameter expression="${invoker.testPropertiesFile}" default-value="test.properties"
      */
     private String testPropertiesFile;
-    
+
     /**
      * Common set of test properties to pass in on each IT's command line, via -D parameters.
-     * 
+     *
      * @parameter
      */
     private Properties testProperties;
 
     /**
      * Whether to show errors in the build output.
-     * 
+     *
      * @parameter expression="${invoker.showErrors}" default-value="false"
      */
     private boolean showErrors;
 
     /**
      * Whether to show debug statements in the build output.
-     * 
+     *
      * @parameter expression="${invoker.debug}" default-value="false"
      */
     private boolean debug;
 
     /**
      * Suppress logging to the build.log file.
-     * 
+     *
      * @parameter expression="${invoker.noLog}" default-value="false"
      */
     private boolean noLog;
 
+    /**
+     * List of profileId's to explicitly trigger in the build.
+     * @parameter
+     */
+    private List profiles;
+
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {
@@ -205,7 +211,7 @@ public class InvokerMojo
                 throw new MojoExecutionException( "Failed to discover projectsDirectory from pom File parameter. Reason: "
                     + e.getMessage(), e );
             }
-            
+
             includedPoms = new String[]{ pom.getName() };
         }
         else
@@ -220,20 +226,20 @@ public class InvokerMojo
                                 + "and projects directory. Reason: " + e.getMessage(), e );
             }
         }
-        
 
-        if ( includedPoms == null || includedPoms.length < 1 )
+
+        if ( ( includedPoms == null ) || ( includedPoms.length < 1 ) )
         {
             getLog().info( "No test-projects were selected for execution." );
             return;
         }
-        
+
         File projectsDir = projectsDirectory;
-        
+
         if ( cloneProjectsTo != null )
         {
             cloneProjectsTo.mkdirs();
-            
+
             try
             {
                 cloneProjects( includedPoms );
@@ -243,7 +249,7 @@ public class InvokerMojo
                 throw new MojoExecutionException( "Failed to clone projects from: " + projectsDirectory + " to: "
                     + cloneProjectsTo + ". Reason: " + e.getMessage(), e );
             }
-            
+
             projectsDir = cloneProjectsTo;
         }
 
@@ -285,7 +291,7 @@ public class InvokerMojo
         if ( !failures.isEmpty() )
         {
             String message = failures.size() + " builds failed.";
-            
+
             throw new MojoFailureException( this, message, message );
         }
     }
@@ -294,12 +300,12 @@ public class InvokerMojo
         throws IOException
     {
         List clonedSubpaths = new ArrayList();
-        
+
         for ( int i = 0; i < includedPoms.length; i++ )
         {
             String subpath = includedPoms[i];
             int lastSep = subpath.lastIndexOf( File.separator );
-            
+
             if ( lastSep > -1 )
             {
                 subpath = subpath.substring( 0, lastSep );
@@ -308,7 +314,7 @@ public class InvokerMojo
             {
                 subpath = ".";
             }
-            
+
             // avoid copying subdirs that are already cloned.
             if ( !alreadyCloned( subpath, clonedSubpaths ) )
             {
@@ -316,18 +322,18 @@ public class InvokerMojo
                 if ( ".".equals( subpath ) )
                 {
                     String cloneSubdir = normalizePath( cloneProjectsTo, projectsDirectory.getCanonicalPath() );
-                    
+
                     // avoid infinite recursion if the cloneTo path is a subdirectory.
                     if ( cloneSubdir != null )
                     {
                         File temp = File.createTempFile( "pre-invocation-clone.", "" );
                         temp.delete();
                         temp.mkdirs();
-                        
+
                         FileUtils.copyDirectoryStructure( projectsDirectory, temp );
-                        
+
                         FileUtils.deleteDirectory( new File( temp, cloneSubdir ) );
-                        
+
                         FileUtils.copyDirectoryStructure( temp, cloneProjectsTo );
                     }
                     else
@@ -339,7 +345,7 @@ public class InvokerMojo
                 {
                     FileUtils.copyDirectoryStructure( new File( projectsDirectory, subpath ), new File( cloneProjectsTo, subpath ) );
                 }
-                
+
                 clonedSubpaths.add( subpath );
             }
         }
@@ -350,13 +356,13 @@ public class InvokerMojo
         for ( Iterator iter = clonedSubpaths.iterator(); iter.hasNext(); )
         {
             String path = (String) iter.next();
-            
+
             if ( ".".equals( path ) || subpath.startsWith( path ) )
             {
                 return true;
             }
         }
-        
+
         return false;
     }
 
@@ -364,7 +370,7 @@ public class InvokerMojo
         throws MojoExecutionException
     {
         File pomFile = new File( projectsDir, pom );
-        
+
         final File basedir = pomFile.getParentFile();
 
         getLog().info( "Building: " + pom );
@@ -389,7 +395,7 @@ public class InvokerMojo
                     {
                         logger = new FileLogger( outputLog );
                     }
-                    
+
                     getLog().debug( "build log initialized in: " + outputLog );
                 }
                 catch ( final IOException e )
@@ -416,7 +422,7 @@ public class InvokerMojo
 
             final InvocationRequest request = new DefaultInvocationRequest();
 
-            if ( invocationGoals.size() == 1 && "_default".equals( invocationGoals.get( 0 ) ) )
+            if ( ( invocationGoals.size() == 1 ) && "_default".equals( invocationGoals.get( 0 ) ) )
             {
                 getLog().debug( "Executing default goal for project in: " + pom );
             }
@@ -430,14 +436,14 @@ public class InvokerMojo
             try
             {
                 Properties collectedTestProperties = new Properties();
-                
+
                 if ( testProperties != null )
                 {
                     collectedTestProperties.putAll( testProperties );
                 }
-                
+
                 final Properties loadedProperties = loadTestProperties( basedir );
-                
+
                 if ( loadedProperties != null )
                 {
                     collectedTestProperties.putAll( loadedProperties );
@@ -474,7 +480,7 @@ public class InvokerMojo
             request.setShowErrors( showErrors );
 
             request.setDebug( debug );
-            
+
             request.setBaseDirectory( basedir );
 
             if ( !noLog )
@@ -485,7 +491,12 @@ public class InvokerMojo
             }
 
             request.setPomFile( pomFile );
-            
+
+            if ( profiles != null )
+            {
+                request.setProfiles( profiles );
+            }
+
             try
             {
                 getLog().debug( "Executing: " + new MavenCommandLineBuilder().build( request ) );
@@ -615,7 +626,7 @@ public class InvokerMojo
 
             PrintStream origOut = System.out;
             PrintStream origErr = System.err;
-            
+
             FileReader reader = null;
             try
             {
@@ -625,7 +636,7 @@ public class InvokerMojo
 
                     System.setErr( logger.getPrintStream() );
                     System.setOut( logger.getPrintStream() );
-                    
+
                     engine.setErr( logger.getPrintStream() );
                     engine.setOut( logger.getPrintStream() );
                 }
@@ -693,7 +704,7 @@ public class InvokerMojo
             {
                 final List goals = readFromFile( projectGoalList );
 
-                if ( goals != null && !goals.isEmpty() )
+                if ( ( goals != null ) && !goals.isEmpty() )
                 {
                     getLog().debug( "Using goals specified in file: " + projectGoalList );
                     invocationGoals = goals;
@@ -708,8 +719,8 @@ public class InvokerMojo
         throws IOException
     {
         String[] poms;
-        
-        if ( pom != null && pom.exists() )
+
+        if ( ( pom != null ) && pom.exists() )
         {
             poms = new String[]{ pom.getAbsolutePath() };
         }
@@ -727,9 +738,9 @@ public class InvokerMojo
 
             poms = fsm.getIncludedFiles( fs );
         }
-        
+
         poms = normalizePomPaths( poms );
-        
+
         return poms;
     }
 
@@ -737,29 +748,29 @@ public class InvokerMojo
         throws IOException
     {
         String projectsDirPath = projectsDirectory.getCanonicalPath();
-        
+
         String[] results = new String[poms.length];
         for ( int i = 0; i < poms.length; i++ )
         {
             String pomPath = poms[i];
-            
+
             File pom = new File( pomPath );
-            
+
             if ( !pom.isAbsolute() )
             {
                 pom = new File( projectsDirectory, pomPath );
             }
-            
+
             String normalizedPath = normalizePath( pom, projectsDirPath );
-            
+
             if ( normalizedPath == null )
             {
                 normalizedPath = pomPath;
             }
-            
+
             results[i] = normalizedPath;
         }
-        
+
         return results;
     }
 
@@ -767,7 +778,7 @@ public class InvokerMojo
         throws IOException
     {
         String normalizedPath = path.getCanonicalPath();
-        
+
         if ( normalizedPath.startsWith( withinDirPath ) )
         {
             normalizedPath = normalizedPath.substring( withinDirPath.length() );
@@ -775,7 +786,7 @@ public class InvokerMojo
             {
                 normalizedPath = normalizedPath.substring( File.separator.length() );
             }
-            
+
             return normalizedPath;
         }
         else
@@ -830,7 +841,7 @@ public class InvokerMojo
     {
         final List result = new ArrayList();
 
-        if ( csv != null && csv.trim().length() > 0 )
+        if ( ( csv != null ) && ( csv.trim().length() > 0 ) )
         {
             final StringTokenizer st = new StringTokenizer( csv, "," );
 

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.

[maven-invoker-plugin] 01/22: Fixing for released maven-invoker, and rolling back the parent pom version to avoid having to release it.

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

hboutemy pushed a commit to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit 8f6160c1cf38c522bcaa3b91b7004c7e93492c6f
Author: John Dennis Casey <jd...@apache.org>
AuthorDate: Wed Jan 17 22:24:59 2007 +0000

    Fixing for released maven-invoker, and rolling back the parent pom version to avoid having to release it.
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin@497209 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 76daf0e..a980ab7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -22,7 +22,7 @@ under the License.
   <parent>
     <artifactId>maven-plugins</artifactId>
     <groupId>org.apache.maven.plugins</groupId>
-    <version>8-SNAPSHOT</version>
+    <version>7</version>
   </parent>
   <artifactId>maven-invoker-plugin</artifactId>
   <version>1.0-SNAPSHOT</version>
@@ -35,7 +35,7 @@ under the License.
     <dependency>
       <groupId>org.apache.maven.shared</groupId>
       <artifactId>maven-invoker</artifactId>
-      <version>2.0.6-SNAPSHOT</version>
+      <version>2.0.6</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.

[maven-invoker-plugin] 07/22: [MINVOKER-2] Applying patch to keep failures from being counted twice.

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

hboutemy pushed a commit to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit 560f6968f2b512e6e4d7dd071e54c979c591bf28
Author: John Dennis Casey <jd...@apache.org>
AuthorDate: Tue May 29 15:58:15 2007 +0000

    [MINVOKER-2] Applying patch to keep failures from being counted twice.
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin@542574 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
index 8e3f374..ce530a5 100644
--- a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
@@ -591,12 +591,10 @@ public class InvokerMojo
             catch ( final IOException e )
             {
                 result = false;
-                failures.add( pom );
             }
             catch ( final EvalError e )
             {
                 result = false;
-                failures.add( pom );
             }
         }
 
@@ -673,12 +671,10 @@ public class InvokerMojo
             catch ( final IOException e )
             {
                 result = false;
-                failures.add( pom );
             }
             catch ( final EvalError e )
             {
                 result = false;
-                failures.add( pom );
             }
         }
 

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.

[maven-invoker-plugin] 10/22: add some @since

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

hboutemy pushed a commit to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit 04441c3e94a2fea77dea9be9ab813d2dc3c6a082
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Sat Nov 17 21:37:34 2007 +0000

    add some @since
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin@596005 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
index 90b00c4..280b22e 100644
--- a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
@@ -68,6 +68,7 @@ public class InvokerMojo
      * build using profiles.
      *
      * @parameter default-value="false"
+     * @since 1.1
      */
     private boolean skipInvocation;
 
@@ -106,6 +107,7 @@ public class InvokerMojo
      * Directory to which projects should be cloned prior to execution.
      *
      * @parameter
+     * @since 1.1
      */
     private File cloneProjectsTo;
 
@@ -201,6 +203,7 @@ public class InvokerMojo
     /**
      * List of profileId's to explicitly trigger in the build.
      * @parameter
+     * @since 1.1
      */
     private List profiles;
 

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.

[maven-invoker-plugin] 05/22: Update parent version to 8, as 8-SNAPSHOT is never deployed and 8 is released

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

hboutemy pushed a commit to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit 3fb23d1ca9de0b8f885667f1960e680d492af722
Author: Kenney Westerhof <ke...@apache.org>
AuthorDate: Wed Mar 14 12:11:00 2007 +0000

    Update parent version to 8, as 8-SNAPSHOT is never deployed and 8 is released
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin@518106 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index b87f34a..107de71 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
   <parent>
     <artifactId>maven-plugins</artifactId>
     <groupId>org.apache.maven.plugins</groupId>
-    <version>8-SNAPSHOT</version>
+    <version>8</version>
   </parent>
   <artifactId>maven-invoker-plugin</artifactId>
   <version>1.1-SNAPSHOT</version>

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.

[maven-invoker-plugin] 17/22: [MINVOKER-13] support a parameter "a la" -Dtest like in surefire

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

hboutemy pushed a commit to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit fa99c3df2c6b701b30016e78fa4774a84265f649
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Fri Nov 30 22:31:36 2007 +0000

    [MINVOKER-13] support a parameter "a la" -Dtest like in surefire
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin@599989 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/maven/plugin/invoker/InvokerMojo.java   | 41 +++++++++++++++++--
 src/site/apt/advance-usage.apt                     |  6 +++
 .../maven/plugin/invoker/InvokerMojoTest.java      | 46 ++++++++++++++++++++++
 src/test/resources/unit/dummy/pom.xml              | 29 ++++++++++++++
 4 files changed, 119 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
index 1fdfea5..845ecad 100644
--- a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
@@ -50,6 +50,7 @@ import org.apache.maven.shared.model.fileset.util.FileSetManager;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.InterpolationFilterReader;
+import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.cli.CommandLineException;
 import org.codehaus.plexus.util.xml.XmlStreamReader;
 
@@ -229,7 +230,17 @@ public class InvokerMojo
      * @readonly
      * @since 1.1
      */
-    private MavenProject project;    
+    private MavenProject project;  
+    
+    /**
+     * Specify this parameter to run individual tests by file name, overriding the <code>pomIncludes</code>
+     * and <code>pomExcludes</code> parameters.  Each pattern you specify here will be used to create an 
+     * include pattern formatted like <code>${projectsDirectory}/${invoker.test}</code>, 
+     * so you can just type "-Dinvoker.test=MyTest" to run a single it in ${projectsDirectory}/${invoker.test}".  
+     * @parameter expression="${invoker.test}"
+     * @since 1.1
+     */    
+    private String invokerTest;
     
     // list to store interpolated pom for delete at the end
     private List/*File*/ interpolatedPomFiles = new ArrayList();
@@ -775,7 +786,7 @@ public class InvokerMojo
         return invocationGoals;
     }
 
-    private String[] getPoms()
+    protected String[] getPoms()
         throws IOException
     {
         String[] poms;
@@ -784,6 +795,30 @@ public class InvokerMojo
         {
             poms = new String[]{ pom.getAbsolutePath() };
         }
+        else if ( invokerTest != null )
+        {
+            String[] testRegexes = StringUtils.split( invokerTest, "," );
+            List /* String */includes = new ArrayList( testRegexes.length );
+            
+            for ( int i = 0, size = testRegexes.length; i < size; i++ )
+            {
+                // user just use -Dinvoker.test=MWAR191,MNG111 to use a directory thats the end is not pom.xml
+                includes.add( testRegexes[i].endsWith( "pom.xml" ) ? testRegexes[i] : testRegexes[i]
+                    + File.separatorChar + "pom.xml" );
+            }
+            
+            final FileSet fs = new FileSet();
+
+            fs.setIncludes( includes );
+            //fs.setExcludes( pomExcludes );
+            fs.setDirectory( projectsDirectory.getCanonicalPath() );
+            fs.setFollowSymlinks( false );
+            fs.setUseDefaultExcludes( false );
+
+            final FileSetManager fsm = new FileSetManager( getLog() );
+
+            poms = fsm.getIncludedFiles( fs );
+        }  
         else
         {
             final FileSet fs = new FileSet();
@@ -803,7 +838,7 @@ public class InvokerMojo
 
         return poms;
     }
-
+    
     private String[] normalizePomPaths( String[] poms )
         throws IOException
     {
diff --git a/src/site/apt/advance-usage.apt b/src/site/apt/advance-usage.apt
index 33e33c9..3748d1e 100755
--- a/src/site/apt/advance-usage.apt
+++ b/src/site/apt/advance-usage.apt
@@ -23,6 +23,12 @@ Advance Usage
   * values from the project pom (you must use @pom.groupId@ notation in your pom file)
   
   * In the plugin configuration you can add some properties in a interpolationsProperties element    
+
+* Running only some tests
+
+  The plugin support a parameter -Dinvoker.test to run only its in the directory match by the expressions 
+  used in the parameter 
+  command line is : mvn -Dinvoker.test=*MWAR*,simple*
     
   
    
\ No newline at end of file
diff --git a/src/test/java/org/apache/maven/plugin/invoker/InvokerMojoTest.java b/src/test/java/org/apache/maven/plugin/invoker/InvokerMojoTest.java
index b676f2b..add82dc 100644
--- a/src/test/java/org/apache/maven/plugin/invoker/InvokerMojoTest.java
+++ b/src/test/java/org/apache/maven/plugin/invoker/InvokerMojoTest.java
@@ -21,6 +21,7 @@ package org.apache.maven.plugin.invoker;
 
 import java.io.File;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
@@ -75,4 +76,49 @@ public class InvokerMojoTest
         invokerMojo.execute();
     }
     
+    public void testSingleInvokerTest()
+        throws Exception
+    {
+        InvokerMojo invokerMojo = new InvokerMojo();
+        setVariableValueToObject( invokerMojo, "goalsFile", "validate-goal.txt" );
+        String dirPath = getBasedir() + "/src/test/resources/unit";
+        List goals = invokerMojo.getGoals( new File( dirPath ) );
+        assertEquals( 1, goals.size() );
+        setVariableValueToObject( invokerMojo, "projectsDirectory", new File( dirPath ) );
+        setVariableValueToObject( invokerMojo, "invokerTest", "*dummy*" );
+        String[] poms = invokerMojo.getPoms();
+        System.out.println( Arrays.asList( poms ) );
+        assertEquals( 1, poms.length );
+    }
+
+    public void testMultiInvokerTest()
+        throws Exception
+    {
+        InvokerMojo invokerMojo = new InvokerMojo();
+        setVariableValueToObject( invokerMojo, "goalsFile", "validate-goal.txt" );
+        String dirPath = getBasedir() + "/src/test/resources/unit";
+        List goals = invokerMojo.getGoals( new File( dirPath ) );
+        assertEquals( 1, goals.size() );
+        setVariableValueToObject( invokerMojo, "projectsDirectory", new File( dirPath ) );
+        setVariableValueToObject( invokerMojo, "invokerTest", "*dummy*,*terpolatio*" );
+        String[] poms = invokerMojo.getPoms();
+        System.out.println( Arrays.asList( poms ) );
+        assertEquals( 2, poms.length );
+    }   
+    
+    public void testFullPatternInvokerTest()
+        throws Exception
+    {
+        InvokerMojo invokerMojo = new InvokerMojo();
+        setVariableValueToObject( invokerMojo, "goalsFile", "validate-goal.txt" );
+        String dirPath = getBasedir() + "/src/test/resources/unit";
+        List goals = invokerMojo.getGoals( new File( dirPath ) );
+        assertEquals( 1, goals.size() );
+        setVariableValueToObject( invokerMojo, "projectsDirectory", new File( dirPath ) );
+        setVariableValueToObject( invokerMojo, "invokerTest", "*" );
+        String[] poms = invokerMojo.getPoms();
+        System.out.println( Arrays.asList( poms ) );
+        assertEquals( 3, poms.length );
+    }    
+    
 }
diff --git a/src/test/resources/unit/dummy/pom.xml b/src/test/resources/unit/dummy/pom.xml
new file mode 100755
index 0000000..ab2014a
--- /dev/null
+++ b/src/test/resources/unit/dummy/pom.xml
@@ -0,0 +1,29 @@
+<?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.test</groupId>
+  <artifactId>unit</artifactId>
+  <packaging>pom</packaging>
+  <version>0.1-SNAPSHOT</version>
+  <properties>
+    <interpolateValue>@foo@</interpolateValue>
+  </properties>
+</project>
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.

[maven-invoker-plugin] 12/22: remove System.out.println

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

hboutemy pushed a commit to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit d31626a8af7c0dbc2578bc752ac59dbf533d8992
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Wed Nov 21 22:57:39 2007 +0000

    remove System.out.println
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin@597242 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
index 7cec502..3c5d486 100644
--- a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
@@ -527,7 +527,6 @@ public class InvokerMojo
 
             try
             {
-                System.out.println( "invoker == null " + (invoker == null) );
                 result = invoker.execute( request );
             }
             catch ( final MavenInvocationException e )

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.

[maven-invoker-plugin] 06/22: Adding ability to clone the project(s) before invoking. This is useful when you actually want to run the main build twice (once nested within the other) without having any collisions on class output dir, etc.

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

hboutemy pushed a commit to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit 2dfe24fc0348165f34bd1fa0f7e0e0ce30725df8
Author: John Dennis Casey <jd...@apache.org>
AuthorDate: Wed Mar 28 23:01:49 2007 +0000

    Adding ability to clone the project(s) before invoking. This is useful when you actually want to run the main build twice (once nested within the other) without having any collisions on class output dir, etc.
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin@523498 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/maven/plugin/invoker/InvokerMojo.java   | 208 +++++++++++++++++++--
 1 file changed, 194 insertions(+), 14 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
index c5a3f68..8e3f374 100644
--- a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
@@ -25,13 +25,16 @@ import bsh.Interpreter;
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.shared.invoker.CommandLineConfigurationException;
 import org.apache.maven.shared.invoker.DefaultInvocationRequest;
 import org.apache.maven.shared.invoker.InvocationRequest;
 import org.apache.maven.shared.invoker.InvocationResult;
 import org.apache.maven.shared.invoker.Invoker;
+import org.apache.maven.shared.invoker.MavenCommandLineBuilder;
 import org.apache.maven.shared.invoker.MavenInvocationException;
 import org.apache.maven.shared.model.fileset.FileSet;
 import org.apache.maven.shared.model.fileset.util.FileSetManager;
+import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
 import org.codehaus.plexus.util.cli.CommandLineException;
 
@@ -92,6 +95,13 @@ public class InvokerMojo
     private File projectsDirectory;
     
     /**
+     * Directory to which projects should be cloned prior to execution.
+     * 
+     * @parameter
+     */
+    private File cloneProjectsTo;
+    
+    /**
      * A single POM to build, skipping any scanning parameters and behavior.
      * 
      * @parameter expression="${invoker.pom}"
@@ -184,21 +194,58 @@ public class InvokerMojo
         throws MojoExecutionException, MojoFailureException
     {
         String[] includedPoms;
-        try
+        if ( pom != null )
         {
-            includedPoms = getPoms();
+            try
+            {
+                projectsDirectory = pom.getCanonicalFile().getParentFile();
+            }
+            catch ( IOException e )
+            {
+                throw new MojoExecutionException( "Failed to discover projectsDirectory from pom File parameter. Reason: "
+                    + e.getMessage(), e );
+            }
+            
+            includedPoms = new String[]{ pom.getName() };
         }
-        catch ( final IOException e )
+        else
         {
-            throw new MojoExecutionException( "Error retrieving POM list from includes, excludes, "
-                            + "and IT directory. Reason: " + e.getMessage(), e );
+            try
+            {
+                includedPoms = getPoms();
+            }
+            catch ( final IOException e )
+            {
+                throw new MojoExecutionException( "Error retrieving POM list from includes, excludes, "
+                                + "and projects directory. Reason: " + e.getMessage(), e );
+            }
         }
+        
 
         if ( includedPoms == null || includedPoms.length < 1 )
         {
             getLog().info( "No test-projects were selected for execution." );
             return;
         }
+        
+        File projectsDir = projectsDirectory;
+        
+        if ( cloneProjectsTo != null )
+        {
+            cloneProjectsTo.mkdirs();
+            
+            try
+            {
+                cloneProjects( includedPoms );
+            }
+            catch ( IOException e )
+            {
+                throw new MojoExecutionException( "Failed to clone projects from: " + projectsDirectory + " to: "
+                    + cloneProjectsTo + ". Reason: " + e.getMessage(), e );
+            }
+            
+            projectsDir = cloneProjectsTo;
+        }
 
         final List failures = new ArrayList();
 
@@ -206,7 +253,7 @@ public class InvokerMojo
         {
             final String pom = includedPoms[i];
 
-            runBuild( pom, failures );
+            runBuild( projectsDir, pom, failures );
         }
 
         if ( !suppressSummaries )
@@ -237,20 +284,87 @@ public class InvokerMojo
 
         if ( !failures.isEmpty() )
         {
-            throw new MojoFailureException( this, "One or more builds failed.", failures.size() + " builds failed." );
+            String message = failures.size() + " builds failed.";
+            
+            throw new MojoFailureException( this, message, message );
         }
     }
 
-    private void runBuild( final String pom, final List failures )
-        throws MojoExecutionException
+    private void cloneProjects( String[] includedPoms )
+        throws IOException
     {
-        File pomFile = new File( pom );
+        List clonedSubpaths = new ArrayList();
         
-        if ( !pomFile.isAbsolute() )
+        for ( int i = 0; i < includedPoms.length; i++ )
+        {
+            String subpath = includedPoms[i];
+            int lastSep = subpath.lastIndexOf( File.separator );
+            
+            if ( lastSep > -1 )
+            {
+                subpath = subpath.substring( 0, lastSep );
+            }
+            else
+            {
+                subpath = ".";
+            }
+            
+            // avoid copying subdirs that are already cloned.
+            if ( !alreadyCloned( subpath, clonedSubpaths ) )
+            {
+                // avoid creating new files that point to dir/.
+                if ( ".".equals( subpath ) )
+                {
+                    String cloneSubdir = normalizePath( cloneProjectsTo, projectsDirectory.getCanonicalPath() );
+                    
+                    // avoid infinite recursion if the cloneTo path is a subdirectory.
+                    if ( cloneSubdir != null )
+                    {
+                        File temp = File.createTempFile( "pre-invocation-clone.", "" );
+                        temp.delete();
+                        temp.mkdirs();
+                        
+                        FileUtils.copyDirectoryStructure( projectsDirectory, temp );
+                        
+                        FileUtils.deleteDirectory( new File( temp, cloneSubdir ) );
+                        
+                        FileUtils.copyDirectoryStructure( temp, cloneProjectsTo );
+                    }
+                    else
+                    {
+                        FileUtils.copyDirectoryStructure( projectsDirectory, cloneProjectsTo );
+                    }
+                }
+                else
+                {
+                    FileUtils.copyDirectoryStructure( new File( projectsDirectory, subpath ), new File( cloneProjectsTo, subpath ) );
+                }
+                
+                clonedSubpaths.add( subpath );
+            }
+        }
+    }
+
+    private boolean alreadyCloned( String subpath, List clonedSubpaths )
+    {
+        for ( Iterator iter = clonedSubpaths.iterator(); iter.hasNext(); )
         {
-            pomFile = new File( projectsDirectory, pom );
+            String path = (String) iter.next();
+            
+            if ( ".".equals( path ) || subpath.startsWith( path ) )
+            {
+                return true;
+            }
         }
         
+        return false;
+    }
+
+    private void runBuild( final File projectsDir, final String pom, final List failures )
+        throws MojoExecutionException
+    {
+        File pomFile = new File( projectsDir, pom );
+        
         final File basedir = pomFile.getParentFile();
 
         getLog().info( "Building: " + pom );
@@ -371,6 +485,15 @@ public class InvokerMojo
             }
 
             request.setPomFile( pomFile );
+            
+            try
+            {
+                getLog().debug( "Executing: " + new MavenCommandLineBuilder().build( request ) );
+            }
+            catch ( CommandLineConfigurationException e )
+            {
+                getLog().debug( "Failed to display command line: " + e.getMessage() );
+            }
 
             InvocationResult result = null;
 
@@ -588,9 +711,11 @@ public class InvokerMojo
     private String[] getPoms()
         throws IOException
     {
+        String[] poms;
+        
         if ( pom != null && pom.exists() )
         {
-            return new String[]{ pom.getAbsolutePath() };
+            poms = new String[]{ pom.getAbsolutePath() };
         }
         else
         {
@@ -604,7 +729,62 @@ public class InvokerMojo
 
             final FileSetManager fsm = new FileSetManager( getLog() );
 
-            return fsm.getIncludedFiles( fs );
+            poms = fsm.getIncludedFiles( fs );
+        }
+        
+        poms = normalizePomPaths( poms );
+        
+        return poms;
+    }
+
+    private String[] normalizePomPaths( String[] poms )
+        throws IOException
+    {
+        String projectsDirPath = projectsDirectory.getCanonicalPath();
+        
+        String[] results = new String[poms.length];
+        for ( int i = 0; i < poms.length; i++ )
+        {
+            String pomPath = poms[i];
+            
+            File pom = new File( pomPath );
+            
+            if ( !pom.isAbsolute() )
+            {
+                pom = new File( projectsDirectory, pomPath );
+            }
+            
+            String normalizedPath = normalizePath( pom, projectsDirPath );
+            
+            if ( normalizedPath == null )
+            {
+                normalizedPath = pomPath;
+            }
+            
+            results[i] = normalizedPath;
+        }
+        
+        return results;
+    }
+
+    private String normalizePath( File path, String withinDirPath )
+        throws IOException
+    {
+        String normalizedPath = path.getCanonicalPath();
+        
+        if ( normalizedPath.startsWith( withinDirPath ) )
+        {
+            normalizedPath = normalizedPath.substring( withinDirPath.length() );
+            if ( normalizedPath.startsWith( File.separator ) )
+            {
+                normalizedPath = normalizedPath.substring( File.separator.length() );
+            }
+            
+            return normalizedPath;
+        }
+        else
+        {
+            return null;
         }
     }
 

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.

[maven-invoker-plugin] 21/22: [MINVOKER-20] Adding properties parameter to replace testProperties, and use the more standard value syntax for properties.

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

hboutemy pushed a commit to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit ce1582671332113d9c7da9d90c6ace79afa55a87
Author: John Dennis Casey <jd...@apache.org>
AuthorDate: Sat Dec 15 22:53:33 2007 +0000

    [MINVOKER-20] Adding properties parameter to replace testProperties, and use the more standard <key>value</key> syntax for properties.
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin@604524 13f79535-47bb-0310-9956-ffa450edef68
---
 .../java/org/apache/maven/plugin/invoker/InvokerMojo.java  | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
index f5e5fc5..7646b9a 100644
--- a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
@@ -183,9 +183,18 @@ public class InvokerMojo
      * Common set of test properties to pass in on each IT's command line, via -D parameters.
      *
      * @parameter
+     * @deprecated Use properties parameter instead.
      */
     private Properties testProperties;
 
+	/**
+	 * Common set of properties to pass in on each project's command line, via -D parameters.
+	 *
+	 * @parameter
+	 * @since 1.1
+	 */
+	private Map properties;
+
     /**
      * Whether to show errors in the build output.
      *
@@ -503,6 +512,11 @@ public class InvokerMojo
                     collectedTestProperties.putAll( testProperties );
                 }
 
+                if ( properties != null )
+                {
+                    collectedTestProperties.putAll( properties );
+                }
+
                 final Properties loadedProperties = loadTestProperties( basedir );
 
                 if ( loadedProperties != null )

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.

[maven-invoker-plugin] 11/22: add unit test

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

hboutemy pushed a commit to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit 4fe657987ac9b6d9e250cb3283ff035efbf3d70c
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Wed Nov 21 22:56:16 2007 +0000

    add unit test
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin@597241 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            | 46 ++++++++++++-
 .../apache/maven/plugin/invoker/InvokerMojo.java   |  7 +-
 .../maven/plugin/invoker/InvokerMojoTest.java      | 80 ++++++++++++++++++++++
 src/test/resources/unit/goals-from-file/goals.txt  |  2 +
 src/test/resources/unit/goals-from-file/pom.xml    | 26 +++++++
 .../unit/goals-from-file/validate-goal.txt         |  1 +
 src/test/resources/unit/goals-from-file/verify.bsh | 49 +++++++++++++
 7 files changed, 209 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index 95169cd..56d4d5e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,9 +1,28 @@
+<?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>
   <parent>
     <artifactId>maven-plugins</artifactId>
     <groupId>org.apache.maven.plugins</groupId>
-    <version>8</version>
+    <version>10</version>
   </parent>
   <artifactId>maven-invoker-plugin</artifactId>
   <version>1.1-SNAPSHOT</version>
@@ -12,6 +31,20 @@
   </prerequisites>   
   <packaging>maven-plugin</packaging>
   <name>Maven Invoker Plugin</name>
+		
+  <scm>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin/</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin/</developerConnection>
+    <url>http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/</url>
+  </scm>	
+  <build>
+    <plugins>
+      <plugin>
+        <artifactId>maven-surefire-plugin</artifactId>
+        <version>2.3</version>
+      </plugin>
+    </plugins>
+  </build>	
   <dependencies>
     <dependency>
       <groupId>org.apache.maven.shared</groupId>
@@ -48,5 +81,16 @@
       <artifactId>bsh</artifactId>
       <version>2.0b4</version>
     </dependency>
+    <dependency>
+      <groupId>org.codehaus.plexus</groupId>
+      <artifactId>plexus-utils</artifactId>
+      <version>1.4.7</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.maven.shared</groupId>
+      <artifactId>maven-plugin-testing-harness</artifactId>
+      <version>1.1</version>
+      <scope>test</scope>
+    </dependency>	
   </dependencies>
 </project>
diff --git a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
index 280b22e..7cec502 100644
--- a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
@@ -527,6 +527,7 @@ public class InvokerMojo
 
             try
             {
+                System.out.println( "invoker == null " + (invoker == null) );
                 result = invoker.execute( request );
             }
             catch ( final MavenInvocationException e )
@@ -584,6 +585,10 @@ public class InvokerMojo
     private Properties loadTestProperties( final File basedir )
         throws IOException
     {
+        if (testProperties == null)
+        {
+            return new Properties();
+        }
         final File testProperties = new File( basedir, testPropertiesFile );
 
         final Properties testProps = new Properties();
@@ -709,7 +714,7 @@ public class InvokerMojo
         return result;
     }
 
-    private List getGoals( final File basedir )
+    protected List getGoals( final File basedir )
     {
         List invocationGoals = goals;
 
diff --git a/src/test/java/org/apache/maven/plugin/invoker/InvokerMojoTest.java b/src/test/java/org/apache/maven/plugin/invoker/InvokerMojoTest.java
new file mode 100644
index 0000000..068a761
--- /dev/null
+++ b/src/test/java/org/apache/maven/plugin/invoker/InvokerMojoTest.java
@@ -0,0 +1,80 @@
+package org.apache.maven.plugin.invoker;
+
+/*
+ * 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.
+ */
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+import org.apache.maven.shared.invoker.Invoker;
+import org.codehaus.plexus.util.FileUtils;
+
+
+/**
+ * @author <a href="mailto:olamy@apache.org">olamy</a>
+ * @since 18 nov. 07
+ * @version $Id$
+ */
+public class InvokerMojoTest
+    extends AbstractMojoTestCase
+{
+
+    /**
+     * test reading goals from a file
+     */
+    public void testReadGoalsFromFile()
+        throws Exception
+    {
+        InvokerMojo invokerMojo = new InvokerMojo();
+        setVariableValueToObject( invokerMojo, "goalsFile", "goals.txt" );
+        String dirPath = getBasedir() + "/src/test/resources/unit/goals-from-file/";
+        List goals = invokerMojo.getGoals( new File( dirPath ) );
+        assertEquals( 3, goals.size() );
+    }
+    
+    public void testSimpleRunValidate()
+        throws Exception
+    {
+        InvokerMojo invokerMojo = new InvokerMojo();
+        setVariableValueToObject( invokerMojo, "goalsFile", "validate-goal.txt" );
+        String dirPath = getBasedir() + "/src/test/resources/unit/goals-from-file/";
+        List goals = invokerMojo.getGoals( new File( dirPath ) );
+        assertEquals( 1, goals.size() );
+        setVariableValueToObject( invokerMojo, "projectsDirectory", new File( dirPath ) );
+        List pomIncludes = new ArrayList();
+        pomIncludes.add( "pom.xml" );
+        setVariableValueToObject( invokerMojo, "pomIncludes", pomIncludes );
+        setVariableValueToObject( invokerMojo, "invoker", getContainer().lookup( Invoker.ROLE ) );
+        File cloneProjectsTo = new File( "target/goals-from-file/" );
+        // clean if exists
+        if ( cloneProjectsTo.exists() )
+        {
+            FileUtils.deleteDirectory( cloneProjectsTo );
+        }
+        //cloneProjectsTo.getParent()
+        setVariableValueToObject( invokerMojo, "cloneProjectsTo", cloneProjectsTo );
+        setVariableValueToObject( invokerMojo, "postBuildHookScript", "verify.bsh" );
+        invokerMojo.execute();
+    }
+    
+}
diff --git a/src/test/resources/unit/goals-from-file/goals.txt b/src/test/resources/unit/goals-from-file/goals.txt
new file mode 100644
index 0000000..e58333f
--- /dev/null
+++ b/src/test/resources/unit/goals-from-file/goals.txt
@@ -0,0 +1,2 @@
+clean , test
+install
\ No newline at end of file
diff --git a/src/test/resources/unit/goals-from-file/pom.xml b/src/test/resources/unit/goals-from-file/pom.xml
new file mode 100644
index 0000000..fc80363
--- /dev/null
+++ b/src/test/resources/unit/goals-from-file/pom.xml
@@ -0,0 +1,26 @@
+<?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.test</groupId>
+  <artifactId>unit</artifactId>
+  <packaging>pom</packaging>
+  <version>0.1-SNAPSHOT</version>
+</project>
\ No newline at end of file
diff --git a/src/test/resources/unit/goals-from-file/validate-goal.txt b/src/test/resources/unit/goals-from-file/validate-goal.txt
new file mode 100644
index 0000000..1d8e0fd
--- /dev/null
+++ b/src/test/resources/unit/goals-from-file/validate-goal.txt
@@ -0,0 +1 @@
+validate
\ No newline at end of file
diff --git a/src/test/resources/unit/goals-from-file/verify.bsh b/src/test/resources/unit/goals-from-file/verify.bsh
new file mode 100644
index 0000000..61c620a
--- /dev/null
+++ b/src/test/resources/unit/goals-from-file/verify.bsh
@@ -0,0 +1,49 @@
+
+/*
+ * 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.
+ */
+
+import java.io.*;
+import org.codehaus.plexus.util.*;
+
+boolean result = true;
+
+try
+{
+    
+    File build = new File ( basedir, "build.log" );
+    if ( !build.exists() || build.isDirectory() )
+    {
+        System.err.println( "build.log file is missing or a directory." );
+        return false;
+    }    
+    FileInputStream fis = new FileInputStream ( build );
+    String buildContent = IOUtil.toString ( fis );
+    int indexOf = buildContent.indexOf( "BUILD SUCCESSFUL" );
+    if ( indexOf < 0)
+    {
+    	System.err.println( "build.log doesn't contains BUILD SUCCESSFUL" );
+    }    
+}
+catch( IOException e )
+{
+    e.printStackTrace();
+    result = false;
+}
+
+return result;

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.

[maven-invoker-plugin] 09/22: Adding skip flag to enable fine-grained control over existing plugin configurations from within a profile, simply by setting a flag.

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

hboutemy pushed a commit to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit 6c985d81eb08bac0194e25255b306da6a9a389b5
Author: John Dennis Casey <jd...@apache.org>
AuthorDate: Wed Oct 3 04:37:49 2007 +0000

    Adding skip flag to enable fine-grained control over existing plugin configurations from within a profile, simply by setting a flag.
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin@581491 13f79535-47bb-0310-9956-ffa450edef68
---
 .../org/apache/maven/plugin/invoker/InvokerMojo.java | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
index e3da80a..90b00c4 100644
--- a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
@@ -19,9 +19,6 @@ package org.apache.maven.plugin.invoker;
  * under the License.
  */
 
-import bsh.EvalError;
-import bsh.Interpreter;
-
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
@@ -51,6 +48,9 @@ import java.util.List;
 import java.util.Properties;
 import java.util.StringTokenizer;
 
+import bsh.EvalError;
+import bsh.Interpreter;
+
 /**
  * Searches for integration test Maven projects, and executes each, collecting a log in the project directory, and
  * outputting the results to the screen.
@@ -64,6 +64,14 @@ public class InvokerMojo
     extends AbstractMojo
 {
     /**
+     * Flag used to suppress certain invocations. This is useful in tailoring the
+     * build using profiles.
+     *
+     * @parameter default-value="false"
+     */
+    private boolean skipInvocation;
+
+    /**
      * Flag used to suppress the summary output notifying of successes and failures. If set to true,
      * the only indication of the build's success or failure will be the effect it has on the main
      * build (if it fails, the main build should fail as well). If streamLogs is enabled, the sub-build
@@ -199,6 +207,12 @@ public class InvokerMojo
     public void execute()
         throws MojoExecutionException, MojoFailureException
     {
+        if ( skipInvocation )
+        {
+            getLog().info( "Skipping invocation per configuration. If this is incorrect, ensure the skipInvocation parameter is not set to true." );
+            return;
+        }
+
         String[] includedPoms;
         if ( pom != null )
         {

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.

[maven-invoker-plugin] 19/22: [MINVOKER-15] fix issueManagement url

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

hboutemy pushed a commit to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit 4e8b8f6ba3681e18bb81f680c3bc9d991d02780b
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Mon Dec 3 21:50:48 2007 +0000

    [MINVOKER-15] fix issueManagement url
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin@600704 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pom.xml b/pom.xml
index 56d4d5e..2689c5c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -37,6 +37,10 @@ under the License.
     <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin/</developerConnection>
     <url>http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/</url>
   </scm>	
+  <issueManagement>
+    <system>jira</system>
+    <url>http://jira.codehaus.org/browse/MINVOKER</url>
+  </issueManagement>
   <build>
     <plugins>
       <plugin>

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.

[maven-invoker-plugin] 18/22: use deleteOnExit() for temporary interpolated pom files

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

hboutemy pushed a commit to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit ed679269279c60ab7e88681eabaac9be3af270fc
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Sat Dec 1 22:10:12 2007 +0000

    use deleteOnExit() for temporary interpolated  pom files
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin@600202 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/maven/plugin/invoker/InvokerMojo.java   | 39 +++-------------------
 .../maven/plugin/invoker/InterpolationTest.java    |  4 ---
 2 files changed, 5 insertions(+), 38 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
index 845ecad..543004c 100644
--- a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
@@ -241,9 +241,6 @@ public class InvokerMojo
      * @since 1.1
      */    
     private String invokerTest;
-    
-    // list to store interpolated pom for delete at the end
-    private List/*File*/ interpolatedPomFiles = new ArrayList();
 
     public void execute()
         throws MojoExecutionException, MojoFailureException
@@ -310,20 +307,13 @@ public class InvokerMojo
 
         final List failures = new ArrayList();
 
-        try
+        for ( int i = 0; i < includedPoms.length; i++ )
         {
-            for ( int i = 0; i < includedPoms.length; i++ )
-            {
-                final String pom = includedPoms[i];
+            final String pom = includedPoms[i];
 
-                runBuild( projectsDir, pom, failures );
-            }
-        }
-        finally
-        {
-            // interpolated files cleanup
-            cleanupInterpolatedPomFiles();
+            runBuild( projectsDir, pom, failures );
         }
+        
 
         if ( !suppressSummaries )
         {
@@ -955,7 +945,7 @@ public class InvokerMojo
         throws MojoExecutionException
     {
         File interpolatedPomFile = new File( targetDirectory, "interpolated-pom.xml" );
-        interpolatedPomFiles.add( interpolatedPomFile );
+        interpolatedPomFile.deleteOnExit();
         Map composite = new CompositeMap( this.project, this.interpolationsProperties );
 
         try
@@ -1006,23 +996,4 @@ public class InvokerMojo
         }
         return interpolatedPomFile;
     }
-    
-    private void cleanupInterpolatedPomFiles()
-    {
-        for ( Iterator iterator = this.interpolatedPomFiles.iterator(); iterator.hasNext(); )
-        {
-            File file = (File) iterator.next();
-            if ( file.exists() )
-            {
-                try
-                {
-                FileUtils.forceDelete( file );
-                } catch (IOException e)
-                {
-                    getLog().warn( "fail to clean file " + file.getPath() );
-                }
-            }
-        }
-    }
-
 }
diff --git a/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java b/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java
index 9fd8166..26ed45b 100755
--- a/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java
+++ b/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java
@@ -110,10 +110,6 @@ public class InterpolationTest
             {
                 fileReader.close();
             }
-            if ( interpolatedPomFile != null )
-            {
-                interpolatedPomFile.delete();
-            }
         }
     }
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.

[maven-invoker-plugin] 20/22: [MINVOKER-10] Capability to define different profiles per it test

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

hboutemy pushed a commit to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit 2644771fb3df9e33e1c47dc065646bcb525ec3d7
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Mon Dec 3 22:31:39 2007 +0000

    [MINVOKER-10] Capability to define different profiles per it test
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin@600713 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/maven/plugin/invoker/InvokerMojo.java   | 54 ++++++++++++++++++++--
 .../maven/plugin/invoker/InterpolationTest.java    | 43 +++++++++++++++++
 .../unit/profiles-from-file/emptyProfiles.txt      |  0
 .../resources/unit/profiles-from-file/profiles.txt |  1 +
 4 files changed, 94 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
index 543004c..f5e5fc5 100644
--- a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
@@ -22,6 +22,7 @@ package org.apache.maven.plugin.invoker;
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
@@ -241,6 +242,14 @@ public class InvokerMojo
      * @since 1.1
      */    
     private String invokerTest;
+    
+    /**
+     * The name of the project-specific file that contains the enumeration of profiles to use for that test.
+     * <b>If the file exists and empty no profiles will be used even if the profiles is set</b>
+     * @parameter expression="${invoker.profilesFile}" default-value="profiles.txt"
+     * @since 1.1
+     */
+    private String profilesFile;
 
     public void execute()
         throws MojoExecutionException, MojoFailureException
@@ -543,10 +552,8 @@ public class InvokerMojo
             }
 
             request.setPomFile( interpolatedPomFile );
-            if ( profiles != null )
-            {
-                request.setProfiles( profiles );
-            }
+
+            request.setProfiles( getProfiles(basedir) );
 
             try
             {
@@ -996,4 +1003,43 @@ public class InvokerMojo
         }
         return interpolatedPomFile;
     }
+    
+    protected List getProfiles( File projectDirectory )
+        throws MojoExecutionException
+    {
+        if ( profilesFile == null )
+        {
+            return profiles == null ? Collections.EMPTY_LIST : profiles;
+        }
+        File projectProfilesFile = new File( projectDirectory, profilesFile );
+        if ( !projectProfilesFile.exists() )
+        {
+            return profiles == null ? Collections.EMPTY_LIST : profiles;
+        }
+        BufferedReader reader = null;
+        try
+        {
+            List profilesInFiles = new ArrayList();
+            reader = new BufferedReader( new FileReader( projectProfilesFile ) );
+            String line = null;
+            while ( ( line = reader.readLine() ) != null )
+            {
+                profilesInFiles.addAll( collectListFromCSV( line ) );
+            }
+            return profilesInFiles;
+        }
+        catch ( FileNotFoundException e )
+        {
+            // as we check first if the file it should not happened
+            throw new MojoExecutionException( projectProfilesFile + " not found ", e );
+        }
+        catch ( IOException e )
+        {
+            throw new MojoExecutionException( "error reading profile in file " + projectProfilesFile + " not found ", e );
+        }
+        finally
+        {
+            IOUtil.close( reader );
+        }
+    }
 }
diff --git a/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java b/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java
index 26ed45b..9f9525d 100755
--- a/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java
+++ b/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java
@@ -20,6 +20,7 @@ package org.apache.maven.plugin.invoker;
 
 import java.io.File;
 import java.io.FileReader;
+import java.util.Arrays;
 import java.util.List;
 import java.util.Properties;
 
@@ -112,4 +113,46 @@ public class InterpolationTest
             }
         }
     }
+    
+    public void testProfilesFromFile()
+        throws Exception
+    {
+        InvokerMojo invokerMojo = new InvokerMojo();
+        setVariableValueToObject( invokerMojo, "profilesFile", "profiles.txt" );
+        String dirPath = getBasedir() + File.separatorChar + "src" + File.separatorChar + "test" + File.separatorChar
+            + "resources" + File.separatorChar + "unit" + File.separatorChar + "profiles-from-file";
+        List profiles = invokerMojo.getProfiles( new File( dirPath ) );
+        assertEquals( 2, profiles.size() );
+        assertTrue( profiles.contains( "foo" ) );
+    }
+    
+    public void testEmptyProfilesFromFile()
+        throws Exception
+    {
+
+        InvokerMojo invokerMojo = new InvokerMojo();
+        setVariableValueToObject( invokerMojo, "profiles", Arrays.asList( new String[] { "zloug" } ) );
+        setVariableValueToObject( invokerMojo, "profilesFile", "emptyProfiles.txt" );
+        String dirPath = getBasedir() + File.separatorChar + "src" + File.separatorChar + "test" + File.separatorChar
+            + "resources" + File.separatorChar + "unit" + File.separatorChar + "profiles-from-file";
+        List profiles = invokerMojo.getProfiles( new File( dirPath ) );
+        assertFalse( profiles.contains( "zloug" ) );
+        assertEquals( 0, profiles.size() );
+
+    }    
+    
+    public void testProfilesWithNoFile()
+        throws Exception
+    {
+
+        InvokerMojo invokerMojo = new InvokerMojo();
+        setVariableValueToObject( invokerMojo, "profiles", Arrays.asList( new String[] { "zloug" } ) );
+        setVariableValueToObject( invokerMojo, "profilesFile", "zorglubProfiles.txt" );
+        String dirPath = getBasedir() + File.separatorChar + "src" + File.separatorChar + "test" + File.separatorChar
+            + "resources" + File.separatorChar + "unit" + File.separatorChar + "profiles-from-file";
+        List profiles = invokerMojo.getProfiles( new File( dirPath ) );
+        assertTrue( profiles.contains( "zloug" ) );
+        assertEquals( 1, profiles.size() );
+
+    }     
 }
diff --git a/src/test/resources/unit/profiles-from-file/emptyProfiles.txt b/src/test/resources/unit/profiles-from-file/emptyProfiles.txt
new file mode 100755
index 0000000..e69de29
diff --git a/src/test/resources/unit/profiles-from-file/profiles.txt b/src/test/resources/unit/profiles-from-file/profiles.txt
new file mode 100755
index 0000000..f33f47f
--- /dev/null
+++ b/src/test/resources/unit/profiles-from-file/profiles.txt
@@ -0,0 +1 @@
+foo, bar

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.

[maven-invoker-plugin] 14/22: [MINVOKER-11] In case of error in bsh evaluation the error must be display this error is displayed with getLog().error in the mojo

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

hboutemy pushed a commit to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit 643d8d5dad478eebe1689ad0e2c1b4c9095ec310
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Sat Nov 24 22:10:15 2007 +0000

    [MINVOKER-11] In case of error in bsh evaluation the error must be display
    this error is displayed with getLog().error in the mojo
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin@597925 13f79535-47bb-0310-9956-ffa450edef68
---
 src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
index 1444404..a5d1077 100644
--- a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
@@ -25,7 +25,6 @@ import java.io.FileInputStream;
 import java.io.FileReader;
 import java.io.IOException;
 import java.io.PrintStream;
-import java.io.StringReader;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
@@ -649,6 +648,9 @@ public class InvokerMojo
             }
             catch ( final EvalError e )
             {
+                String errorMessage = "error evaluating script " + basedir.getPath() + File.separatorChar
+                    + postBuildHookScript + ", " + e.getMessage();
+                getLog().error( errorMessage, e );
                 result = false;
             }
         }
@@ -729,6 +731,9 @@ public class InvokerMojo
             }
             catch ( final EvalError e )
             {
+                String errorMessage = "error evaluating script " + basedir.getPath() + File.separatorChar
+                    + postBuildHookScript + ", " + e.getMessage();
+                getLog().error( errorMessage, e );                
                 result = false;
             }
         }

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.

[maven-invoker-plugin] 04/22: update parent

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

hboutemy pushed a commit to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit efbb386db67067f271f480ceec8730fa0b9fe8fd
Author: Brett Leslie Porter <br...@apache.org>
AuthorDate: Tue Feb 6 09:36:31 2007 +0000

    update parent
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin@504053 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index dc3e7c9..b87f34a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
   <parent>
     <artifactId>maven-plugins</artifactId>
     <groupId>org.apache.maven.plugins</groupId>
-    <version>7</version>
+    <version>8-SNAPSHOT</version>
   </parent>
   <artifactId>maven-invoker-plugin</artifactId>
   <version>1.1-SNAPSHOT</version>
@@ -49,4 +49,4 @@
       <version>2.0b4</version>
     </dependency>
   </dependencies>
-</project>
\ No newline at end of file
+</project>

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.

[maven-invoker-plugin] 02/22: [maven-release-plugin] prepare release maven-invoker-plugin-1.0

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

hboutemy pushed a commit to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit 9562738a5d68b23e12cd20c255aaefacaa3fe672
Author: John Dennis Casey <jd...@apache.org>
AuthorDate: Wed Jan 17 22:25:56 2007 +0000

    [maven-release-plugin] prepare release maven-invoker-plugin-1.0
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin@497210 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml | 30 ++++++++----------------------
 1 file changed, 8 insertions(+), 22 deletions(-)

diff --git a/pom.xml b/pom.xml
index a980ab7..6b3a762 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,23 +1,4 @@
-<!--
-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: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' xmlns='http://maven.apache.org/POM/4.0.0'>
+<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>
   <parent>
     <artifactId>maven-plugins</artifactId>
@@ -25,7 +6,7 @@ under the License.
     <version>7</version>
   </parent>
   <artifactId>maven-invoker-plugin</artifactId>
-  <version>1.0-SNAPSHOT</version>
+  <version>1.0</version>
   <prerequisites>                                                                                                                                                      
     <maven>2.0</maven>                                                                                                                                                 
   </prerequisites>   
@@ -68,5 +49,10 @@ under the License.
       <version>2.0b4</version>
     </dependency>
   </dependencies>
-</project>
 
+  <scm>
+    <connection>scm:svn:https://svn.apache.org/repos/asf/maven/plugins/tags/maven-invoker-plugin-1.0</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/plugins/tags/maven-invoker-plugin-1.0</developerConnection>
+    <url>https://svn.apache.org/repos/asf/maven/plugins/tags/maven-invoker-plugin-1.0</url>
+  </scm>
+</project>
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.

[maven-invoker-plugin] 13/22: [MINVOKER-9] Interpolate goal files with project and new properties field

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

hboutemy pushed a commit to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit 14816a55c03831a43fdc4a0f86747f655761e8aa
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Thu Nov 22 23:03:30 2007 +0000

    [MINVOKER-9] Interpolate goal files with project and new properties field
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin@597507 13f79535-47bb-0310-9956-ffa450edef68
---
 .../apache/maven/plugin/invoker/CompositeMap.java  | 176 +++++++++++++++++++++
 .../apache/maven/plugin/invoker/InvokerMojo.java   |  53 +++++--
 .../plugin/invoker/ExtendedMavenProjectStub.java   |  43 +++++
 .../maven/plugin/invoker/InterpolationTest.java    |  80 ++++++++++
 .../maven/plugin/invoker/InvokerMojoTest.java      |   2 -
 src/test/resources/unit/interpolation/goals.txt    |   2 +
 6 files changed, 340 insertions(+), 16 deletions(-)

diff --git a/src/main/java/org/apache/maven/plugin/invoker/CompositeMap.java b/src/main/java/org/apache/maven/plugin/invoker/CompositeMap.java
new file mode 100755
index 0000000..7792946
--- /dev/null
+++ b/src/main/java/org/apache/maven/plugin/invoker/CompositeMap.java
@@ -0,0 +1,176 @@
+/*
+ * 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.
+ */
+package org.apache.maven.plugin.invoker;
+
+import java.util.Collection;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.maven.project.MavenProject;
+import org.codehaus.plexus.util.introspection.ReflectionValueExtractor;
+
+/**
+ * @author <a href="mailto:olamy@apache.org">olamy</a>
+ * @since 22 nov. 07
+ * @version $Id$
+ */
+class CompositeMap
+    implements Map
+{
+    
+    private MavenProject mavenProject;
+    
+    private Properties properties;
+    
+    protected CompositeMap(MavenProject mavenProject, Properties properties)
+    {
+        this.mavenProject = mavenProject;
+        this.properties = properties == null ? new Properties() : properties;
+    }
+
+    /** 
+     * @see java.util.Map#clear()
+     */
+    public void clear()
+    {
+        // nothing here
+
+    }
+
+    /** 
+     * @see java.util.Map#containsKey(java.lang.Object)
+     */
+    public boolean containsKey( Object key )
+    {
+        if ( key == null )
+        {
+            return false;
+        }
+        try
+        {
+            Object evaluated = ReflectionValueExtractor.evaluate( (String) key, this.mavenProject );
+            return evaluated == null;
+        }
+        catch ( Exception e )
+        {
+            // uhm do we have to throw a RuntimeException here ? 
+        }
+        return properties.containsKey( key );
+    }
+
+    /** 
+     * @see java.util.Map#containsValue(java.lang.Object)
+     */
+    public boolean containsValue( Object value )
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    /** 
+     * @see java.util.Map#entrySet()
+     */
+    public Set entrySet()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    /** 
+     * @see java.util.Map#get(java.lang.Object)
+     */
+    public Object get( Object key )
+    {
+        if ( key == null )
+        {
+            return null;
+        }
+        try
+        {
+            Object evaluated = ReflectionValueExtractor.evaluate( (String) key, this.mavenProject );
+            if ( evaluated != null )
+            {
+                return evaluated;
+            }
+        }
+        catch ( Exception e )
+        {
+            // uhm do we have to throw a RuntimeException here ? 
+        }
+        return properties.get( key );
+    }
+
+    /** 
+     * @see java.util.Map#isEmpty()
+     */
+    public boolean isEmpty()
+    {
+        return this.mavenProject == null && this.properties.isEmpty();
+    }
+
+    /** 
+     * @see java.util.Map#keySet()
+     */
+    public Set keySet()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    /** 
+     * @see java.util.Map#put(java.lang.Object, java.lang.Object)
+     */
+    public Object put( Object key, Object value )
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    /** 
+     * @see java.util.Map#putAll(java.util.Map)
+     */
+    public void putAll( Map t )
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    /** 
+     * @see java.util.Map#remove(java.lang.Object)
+     */
+    public Object remove( Object key )
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    /** 
+     * @see java.util.Map#size()
+     */
+    public int size()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    /** 
+     * @see java.util.Map#values()
+     */
+    public Collection values()
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    
+    
+}
diff --git a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
index 3c5d486..1444404 100644
--- a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
@@ -19,9 +19,25 @@ package org.apache.maven.plugin.invoker;
  * under the License.
  */
 
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
 import org.apache.maven.plugin.AbstractMojo;
 import org.apache.maven.plugin.MojoExecutionException;
 import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.project.MavenProject;
 import org.apache.maven.shared.invoker.CommandLineConfigurationException;
 import org.apache.maven.shared.invoker.DefaultInvocationRequest;
 import org.apache.maven.shared.invoker.InvocationRequest;
@@ -33,21 +49,9 @@ import org.apache.maven.shared.model.fileset.FileSet;
 import org.apache.maven.shared.model.fileset.util.FileSetManager;
 import org.codehaus.plexus.util.FileUtils;
 import org.codehaus.plexus.util.IOUtil;
+import org.codehaus.plexus.util.InterpolationFilterReader;
 import org.codehaus.plexus.util.cli.CommandLineException;
 
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Properties;
-import java.util.StringTokenizer;
-
 import bsh.EvalError;
 import bsh.Interpreter;
 
@@ -202,10 +206,29 @@ public class InvokerMojo
 
     /**
      * List of profileId's to explicitly trigger in the build.
+     * 
      * @parameter
      * @since 1.1
      */
     private List profiles;
+    
+    /**
+     * List properties which will be used to interpolate goal files.
+     * 
+     * @parameter
+     * @since 1.1
+     */    
+    private Properties interpolationsProperties;
+    
+    /**
+     * The Maven Project Object
+     *
+     * @parameter expression="${project}"
+     * @required
+     * @readonly
+     * @since 1.1
+     */
+    private MavenProject project;    
 
     public void execute()
         throws MojoExecutionException, MojoFailureException
@@ -824,7 +847,9 @@ public class InvokerMojo
 
         try
         {
-            reader = new BufferedReader( new FileReader( projectGoalList ) );
+            Map composite = new CompositeMap(this.project, this.interpolationsProperties);
+            reader = new BufferedReader( new InterpolationFilterReader( new FileReader( projectGoalList ), composite ) );
+            /// new BufferedReader( new FileReader( projectGoalList ) );
 
             result = new ArrayList();
 
diff --git a/src/test/java/org/apache/maven/plugin/invoker/ExtendedMavenProjectStub.java b/src/test/java/org/apache/maven/plugin/invoker/ExtendedMavenProjectStub.java
new file mode 100755
index 0000000..c598b94
--- /dev/null
+++ b/src/test/java/org/apache/maven/plugin/invoker/ExtendedMavenProjectStub.java
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+package org.apache.maven.plugin.invoker;
+
+import org.apache.maven.model.Scm;
+import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+
+/**
+ * @author <a href="mailto:olamy@apache.org">olamy</a>
+ * @since 22 nov. 07
+ * @version $Id$
+ */
+public class ExtendedMavenProjectStub
+    extends MavenProjectStub
+{
+    private Scm scm;
+
+    public Scm getScm()
+    {
+        return scm;
+    }
+
+    public void setScm( Scm scm )
+    {
+        this.scm = scm;
+    }
+}
diff --git a/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java b/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java
new file mode 100755
index 0000000..0a4ec44
--- /dev/null
+++ b/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java
@@ -0,0 +1,80 @@
+/*
+ * 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.
+ */
+package org.apache.maven.plugin.invoker;
+
+import java.io.File;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.maven.model.Scm;
+import org.apache.maven.plugin.testing.AbstractMojoTestCase;
+import org.apache.maven.plugin.testing.stubs.MavenProjectStub;
+
+/**
+ * @author <a href="mailto:olamy@apache.org">olamy</a>
+ * @since 22 nov. 07
+ * @version $Id$
+ */
+public class InterpolationTest
+    extends AbstractMojoTestCase
+{
+    
+    protected MavenProjectStub buildMavenProjectStub()
+    {
+        ExtendedMavenProjectStub project = new ExtendedMavenProjectStub();
+        project.setVersion( "1.0-SNAPSHOT" );
+        project.setArtifactId( "foo" );
+        project.setGroupId( "bar" );
+        Scm scm = new Scm();
+        scm.setConnection( "http://blabla" );
+        project.setScm( scm );
+        return project;
+    }
+    
+    public void testCompositeMap()
+        throws Exception
+    {
+
+        Properties properties = new Properties();
+        properties.put( "foo", "bar" );
+        properties.put( "version", "2.0-SNAPSHOT" );
+        CompositeMap compositeMap = new CompositeMap( buildMavenProjectStub(), properties );
+        assertEquals( "1.0-SNAPSHOT", compositeMap.get( "pom.version" ) );
+        assertEquals( "bar", compositeMap.get( "foo" ) );
+        assertEquals( "bar", compositeMap.get( "pom.groupId" ) );
+        assertEquals( "http://blabla", compositeMap.get( "pom.scm.connection" ) );
+    }
+    
+    public void testInterpolationGoalsFile()
+        throws Exception
+    {
+        InvokerMojo invokerMojo = new InvokerMojo();
+        setVariableValueToObject( invokerMojo, "goalsFile", "goals.txt" );
+        setVariableValueToObject( invokerMojo, "project", buildMavenProjectStub() );
+        Properties properties = new Properties();
+        properties.put( "cleanProps", "clean" );
+        properties.put( "version", "2.0-SNAPSHOT" );
+        setVariableValueToObject( invokerMojo, "interpolationsProperties", properties );
+        String dirPath = getBasedir() + "/src/test/resources/unit/interpolation/";
+        List goals = invokerMojo.getGoals( new File( dirPath ) );
+        assertEquals( goals.toString(), 2, goals.size() );
+        assertEquals( "clean", goals.get( 0 ) );
+        assertEquals( "bar:foo:1.0-SNAPSHOT:mygoal", goals.get( 1 ) );
+    }
+}
diff --git a/src/test/java/org/apache/maven/plugin/invoker/InvokerMojoTest.java b/src/test/java/org/apache/maven/plugin/invoker/InvokerMojoTest.java
index 068a761..b676f2b 100644
--- a/src/test/java/org/apache/maven/plugin/invoker/InvokerMojoTest.java
+++ b/src/test/java/org/apache/maven/plugin/invoker/InvokerMojoTest.java
@@ -21,9 +21,7 @@ package org.apache.maven.plugin.invoker;
 
 import java.io.File;
 import java.util.ArrayList;
-import java.util.Enumeration;
 import java.util.List;
-import java.util.Properties;
 
 import org.apache.maven.plugin.testing.AbstractMojoTestCase;
 import org.apache.maven.shared.invoker.Invoker;
diff --git a/src/test/resources/unit/interpolation/goals.txt b/src/test/resources/unit/interpolation/goals.txt
new file mode 100755
index 0000000..b9d46e8
--- /dev/null
+++ b/src/test/resources/unit/interpolation/goals.txt
@@ -0,0 +1,2 @@
+${cleanProps} 
+${pom.groupId}:${pom.artifactId}:${pom.version}:mygoal
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.

[maven-invoker-plugin] 22/22: [maven-release-plugin] copy for tag maven-invoker-plugin-1.1

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

hboutemy pushed a commit to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit 0a96498c413f2c422653cd88adc50eafed8a4a85
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Mon Dec 17 09:02:55 2007 +0000

    [maven-release-plugin]  copy for tag maven-invoker-plugin-1.1
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/tags/maven-invoker-plugin-1.1@604797 13f79535-47bb-0310-9956-ffa450edef68
---
 pom.xml                                            | 39 +++++++---------------
 .../apache/maven/plugin/invoker/InvokerMojo.java   |  9 +++--
 .../maven/plugin/invoker/InterpolationTest.java    | 12 +++++++
 3 files changed, 31 insertions(+), 29 deletions(-)

diff --git a/pom.xml b/pom.xml
index 2689c5c..cf1f779 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,22 +1,3 @@
-<?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>
   <parent>
@@ -25,17 +6,17 @@ under the License.
     <version>10</version>
   </parent>
   <artifactId>maven-invoker-plugin</artifactId>
-  <version>1.1-SNAPSHOT</version>
-  <prerequisites>                                                                                                                                                      
-    <maven>2.0</maven>                                                                                                                                                 
+  <version>1.1</version>
+  <prerequisites>
+    <maven>2.0.6</maven>
   </prerequisites>   
   <packaging>maven-plugin</packaging>
   <name>Maven Invoker Plugin</name>
 		
   <scm>
-    <connection>scm:svn:http://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin/</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin/</developerConnection>
-    <url>http://svn.apache.org/viewvc/maven/plugins/trunk/maven-invoker-plugin/</url>
+    <connection>scm:svn:http://svn.apache.org/repos/asf/maven/plugins/tags/maven-invoker-plugin-1.1</connection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/maven/plugins/tags/maven-invoker-plugin-1.1</developerConnection>
+    <url>http://svn.apache.org/viewvc/maven/plugins/tags/maven-invoker-plugin-1.1</url>
   </scm>	
   <issueManagement>
     <system>jira</system>
@@ -47,13 +28,17 @@ under the License.
         <artifactId>maven-surefire-plugin</artifactId>
         <version>2.3</version>
       </plugin>
+      <plugin>
+        <artifactId>maven-source-plugin</artifactId>
+        <version>2.0.4</version>
+      </plugin>      
     </plugins>
   </build>	
   <dependencies>
     <dependency>
       <groupId>org.apache.maven.shared</groupId>
       <artifactId>maven-invoker</artifactId>
-      <version>2.0.7-SNAPSHOT</version>
+      <version>2.0.7</version>
     </dependency>
     <dependency>
       <groupId>org.apache.maven</groupId>
@@ -97,4 +82,4 @@ under the License.
       <scope>test</scope>
     </dependency>	
   </dependencies>
-</project>
+</project>
\ No newline at end of file
diff --git a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
index 7646b9a..cb97e0f 100644
--- a/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugin/invoker/InvokerMojo.java
@@ -909,7 +909,7 @@ public class InvokerMojo
 
         try
         {
-            Map composite = new CompositeMap(this.project, this.interpolationsProperties);
+            Map composite = new CompositeMap( this.project, this.interpolationsProperties );
             reader = new BufferedReader( new InterpolationFilterReader( new FileReader( projectGoalList ), composite ) );
             /// new BufferedReader( new FileReader( projectGoalList ) );
 
@@ -925,7 +925,7 @@ public class InvokerMojo
         {
             getLog().warn(
                            "Failed to load goal list from file: " + projectGoalList
-                                           + ". Using 'goal' parameter configured on this plugin instead." );
+                               + ". Using 'goal' parameter configured on this plugin instead." );
             getLog().debug( "Error reading goals file: " + projectGoalList, e );
         }
         finally
@@ -966,6 +966,10 @@ public class InvokerMojo
         throws MojoExecutionException
     {
         File interpolatedPomFile = new File( targetDirectory, "interpolated-pom.xml" );
+        if (interpolatedPomFile.exists())
+        {
+            interpolatedPomFile.delete();
+        }
         interpolatedPomFile.deleteOnExit();
         Map composite = new CompositeMap( this.project, this.interpolationsProperties );
 
@@ -997,6 +1001,7 @@ public class InvokerMojo
                 fileWriter.write( line );
             }
             fileWriter.flush();
+            fileWriter.close();
         }
         catch ( IOException e )
         {
diff --git a/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java b/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java
index 9f9525d..03b464d 100755
--- a/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java
+++ b/src/test/java/org/apache/maven/plugin/invoker/InterpolationTest.java
@@ -104,6 +104,18 @@ public class InterpolationTest
             fileReader = new FileReader( interpolatedPomFile );
             String content = IOUtil.toString( fileReader );
             assertTrue( content.indexOf( "<interpolateValue>bar</interpolateValue>" ) > 0 );
+            fileReader.close();
+            // recreate it to test delete if exists before creation
+            interpolatedPomFile = invokerMojo.buildInterpolatedPomFile( new File( dirPath, "pom.xml" ),
+                                                                        new File( getBasedir() + File.separatorChar
+                                                                            + "target" ) );
+            fileReader = new FileReader( interpolatedPomFile );
+            content = IOUtil.toString( fileReader );
+            assertTrue( content.indexOf( "<interpolateValue>bar</interpolateValue>" ) > 0 );
+            fileReader.close();
+        } catch (Exception e)
+        {
+            throw e;
         }
         finally
         {

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.

[maven-invoker-plugin] 15/22: add a documentation on goals files interpolation

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

hboutemy pushed a commit to annotated tag maven-invoker-plugin-1.1
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git

commit a174e868db79b77c49b71de397e604d6dc81d851
Author: Oliver Lamy <ol...@apache.org>
AuthorDate: Sun Nov 25 20:03:13 2007 +0000

    add a documentation on goals files interpolation
    
    
    git-svn-id: https://svn.apache.org/repos/asf/maven/plugins/trunk/maven-invoker-plugin@598046 13f79535-47bb-0310-9956-ffa450edef68
---
 src/site/apt/advance-usage.apt | 21 +++++++++++++++++++++
 src/site/site.xml              |  1 +
 2 files changed, 22 insertions(+)

diff --git a/src/site/apt/advance-usage.apt b/src/site/apt/advance-usage.apt
new file mode 100755
index 0000000..5a77453
--- /dev/null
+++ b/src/site/apt/advance-usage.apt
@@ -0,0 +1,21 @@
+ ------
+ Advance Usage
+ ------
+ Olivier Lamy
+ ------
+ 24 November 2007
+ ------
+ 
+Advance Usage
+
+* Goals file Interpolation
+
+  goals files can be interpolated with some values : 
+  
+  * values from the project pom (you can use $\{pom.groupId} in your goals file)
+  
+  * In the plugin configuration you can add some properties in a interpolationsProperties element
+    
+    
+  
+   
\ No newline at end of file
diff --git a/src/site/site.xml b/src/site/site.xml
index 7332b52..490b49f 100644
--- a/src/site/site.xml
+++ b/src/site/site.xml
@@ -25,6 +25,7 @@ under the License.
       <item name="Introduction" href="index.html"/>
       <item name="Goals" href="plugin-info.html"/>
       <item name="Usage" href="usage.html"/>
+      <item name="Advance Usage" href="advance-usage.html"/>
       <item name="FAQ" href="faq.html"/>
     </menu>
     <!--

-- 
To stop receiving notification emails like this one, please contact
"commits@maven.apache.org" <co...@maven.apache.org>.