continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r734652 - in /continuum/trunk: continuum-commons/src/main/java/org/apache/continuum/utils/shell/ continuum-release/src/main/java/org/apache/continuum/release/phase/ continuum-release/src/main/resources/META-INF/plexus/
Date Thu, 15 Jan 2009 09:51:46 GMT
Author: ctan
Date: Thu Jan 15 01:51:45 2009
New Revision: 734652

URL: http://svn.apache.org/viewvc?rev=734652&view=rev
Log:
[CONTINUUM-1513] resolve maven 2 executable from build environment when releasing

Modified:
    continuum/trunk/continuum-commons/src/main/java/org/apache/continuum/utils/shell/DefaultShellCommandHelper.java
    continuum/trunk/continuum-commons/src/main/java/org/apache/continuum/utils/shell/ShellCommandHelper.java
    continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/phase/AbstractContinuumRunGoalsPhase.java
    continuum/trunk/continuum-release/src/main/resources/META-INF/plexus/components.xml

Modified: continuum/trunk/continuum-commons/src/main/java/org/apache/continuum/utils/shell/DefaultShellCommandHelper.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-commons/src/main/java/org/apache/continuum/utils/shell/DefaultShellCommandHelper.java?rev=734652&r1=734651&r2=734652&view=diff
==============================================================================
--- continuum/trunk/continuum-commons/src/main/java/org/apache/continuum/utils/shell/DefaultShellCommandHelper.java
(original)
+++ continuum/trunk/continuum-commons/src/main/java/org/apache/continuum/utils/shell/DefaultShellCommandHelper.java
Thu Jan 15 01:51:45 2009
@@ -26,6 +26,7 @@
 import java.util.Iterator;
 import java.util.Map;
 
+import org.apache.maven.continuum.installation.InstallationService;
 import org.apache.maven.shared.release.ReleaseResult;
 import org.apache.maven.shared.release.exec.MavenExecutorException;
 import org.apache.maven.shared.release.exec.TeeConsumer;
@@ -161,7 +162,7 @@
         CommandLineUtils.killProcess( idCommand );
     }
 
-    public void executeGoals( File workingDirectory, String goals, boolean interactive, String
arguments,
+    public void executeGoals( File workingDirectory, String executable, String goals, boolean
interactive, String arguments,
                               ReleaseResult relResult, Map<String, String> environments
)
         throws Exception
     {
@@ -171,14 +172,19 @@
 
         argument.setLine( arguments );
 
-        executeGoals( workingDirectory, goals, interactive, argument.getParts(), relResult,
environments );
+        executeGoals( workingDirectory, executable, goals, interactive, argument.getParts(),
relResult, environments );
     }
 
-    public void executeGoals( File workingDirectory, String goals, boolean interactive, String[]
arguments,
+    public void executeGoals( File workingDirectory, String executable, String goals, boolean
interactive, String[] arguments,
                               ReleaseResult relResult, Map<String, String> environments
)
         throws Exception
     {
-        Commandline cl = createCommandline( workingDirectory, "mvn", arguments, -1, environments
);
+        if ( executable == null )
+        {
+            executable = "mvn";
+        }
+
+        Commandline cl = createCommandline( workingDirectory, executable, arguments, -1,
environments );
 
         if ( goals != null )
         {

Modified: continuum/trunk/continuum-commons/src/main/java/org/apache/continuum/utils/shell/ShellCommandHelper.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-commons/src/main/java/org/apache/continuum/utils/shell/ShellCommandHelper.java?rev=734652&r1=734651&r2=734652&view=diff
==============================================================================
--- continuum/trunk/continuum-commons/src/main/java/org/apache/continuum/utils/shell/ShellCommandHelper.java
(original)
+++ continuum/trunk/continuum-commons/src/main/java/org/apache/continuum/utils/shell/ShellCommandHelper.java
Thu Jan 15 01:51:45 2009
@@ -45,11 +45,11 @@
 
     void killProcess( long idCommand );
 
-    void executeGoals( File workingDirectory, String goals, boolean interactive, String arguments,
+    void executeGoals( File workingDirectory, String executable, String goals, boolean interactive,
String arguments,
                        ReleaseResult relResult, Map<String, String> environments )
         throws Exception;
 
-    void executeGoals( File workingDirectory, String goals, boolean interactive, String[]
arguments,
+    void executeGoals( File workingDirectory, String executable, String goals, boolean interactive,
String[] arguments,
                        ReleaseResult relResult, Map<String, String> environments )
         throws Exception;
 }

Modified: continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/phase/AbstractContinuumRunGoalsPhase.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/phase/AbstractContinuumRunGoalsPhase.java?rev=734652&r1=734651&r2=734652&view=diff
==============================================================================
--- continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/phase/AbstractContinuumRunGoalsPhase.java
(original)
+++ continuum/trunk/continuum-release/src/main/java/org/apache/continuum/release/phase/AbstractContinuumRunGoalsPhase.java
Thu Jan 15 01:51:45 2009
@@ -24,6 +24,7 @@
 
 import org.apache.continuum.release.config.ContinuumReleaseDescriptor;
 import org.apache.continuum.utils.shell.ShellCommandHelper;
+import org.apache.maven.continuum.installation.InstallationService;
 import org.apache.maven.shared.release.ReleaseExecutionException;
 import org.apache.maven.shared.release.ReleaseResult;
 import org.apache.maven.shared.release.config.ReleaseDescriptor;
@@ -41,6 +42,11 @@
      */
     private ShellCommandHelper shellCommandHelper;
 
+    /**
+     * @plexus.requirement
+     */
+    private InstallationService installationService;
+
     public ReleaseResult execute( ReleaseDescriptor releaseDescriptor, File workingDirectory,
                                   String additionalArguments )
         throws ReleaseExecutionException
@@ -58,10 +64,21 @@
                 {
                     environments = ( (ContinuumReleaseDescriptor) releaseDescriptor ).getEnvironments();
                 }
-                
+
+                String executable = installationService.getExecutorConfigurator( InstallationService.MAVEN2_TYPE
).getExecutable();
+
+                if ( environments != null )
+                {
+                    String m2Home = environments.get( installationService.getEnvVar( InstallationService.MAVEN2_TYPE
) );
+                    if ( StringUtils.isNotEmpty( m2Home ) )
+                    {
+                        executable = m2Home + File.separator + "bin" + File.separator + executable;
+                    }
+                }
+
                 shellCommandHelper.executeGoals( determineWorkingDirectory( workingDirectory,
                                                                             releaseDescriptor.getScmRelativePathProjectDirectory()
),
-                                                 goals, releaseDescriptor.isInteractive(),
additionalArguments, result, 
+                                                 executable, goals, releaseDescriptor.isInteractive(),
additionalArguments, result, 
                                                  environments );
             }
         }

Modified: continuum/trunk/continuum-release/src/main/resources/META-INF/plexus/components.xml
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-release/src/main/resources/META-INF/plexus/components.xml?rev=734652&r1=734651&r2=734652&view=diff
==============================================================================
--- continuum/trunk/continuum-release/src/main/resources/META-INF/plexus/components.xml (original)
+++ continuum/trunk/continuum-release/src/main/resources/META-INF/plexus/components.xml Thu
Jan 15 01:51:45 2009
@@ -315,6 +315,9 @@
         <requirement>
           <role>org.apache.continuum.utils.shell.ShellCommandHelper</role>
         </requirement>
+        <requirement>
+          <role>org.apache.maven.continuum.installation.InstallationService</role>
+        </requirement>
       </requirements>
     </component>
     <component>
@@ -325,6 +328,9 @@
         <requirement>
           <role>org.apache.continuum.utils.shell.ShellCommandHelper</role>
         </requirement>
+        <requirement>
+          <role>org.apache.maven.continuum.installation.InstallationService</role>
+        </requirement>
       </requirements>
     </component>
     



Mime
View raw message