You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Jan Edelbroek (JIRA)" <ji...@codehaus.org> on 2007/02/23 11:28:27 UTC

[jira] Created: (CONTINUUM-1182) Pass configured scm username and password to execution of maven goals

Pass configured scm username and password to execution of maven goals
---------------------------------------------------------------------

                 Key: CONTINUUM-1182
                 URL: http://jira.codehaus.org/browse/CONTINUUM-1182
             Project: Continuum
          Issue Type: Improvement
          Components: Core system
            Reporter: Jan Edelbroek


It's possible to configure a scm username and password. Continuum uses this to update the sourcecode from the scm before the actual build takes place.
Because of this feature, i don't have to configure this in my project pom for maven2.
It would be nice if i could use these username and password also for executing maven goals.

For example, if i use the scm:tag goal in my build definition, it would be nice to have something like this in my maven2 build definition:
clean install scm:tag -Dusername=${scm.username} -Dpassword=${scm.password}

In this case, continuum should substitute the configured scm username and password before executing the build.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Closed: (CONTINUUM-1182) Pass configured scm username and password to execution of maven goals

Posted by "Emmanuel Venisse (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/CONTINUUM-1182?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Venisse closed CONTINUUM-1182.
---------------------------------------

    Resolution: Won't Fix

The best way is to use properties defined in settings.xml

> Pass configured scm username and password to execution of maven goals
> ---------------------------------------------------------------------
>
>                 Key: CONTINUUM-1182
>                 URL: http://jira.codehaus.org/browse/CONTINUUM-1182
>             Project: Continuum
>          Issue Type: Improvement
>          Components: Core system
>            Reporter: Jan Edelbroek
>
> It's possible to configure a scm username and password. Continuum uses this to update the sourcecode from the scm before the actual build takes place.
> Because of this feature, i don't have to configure this in my project pom for maven2.
> It would be nice if i could use these username and password also for executing maven goals.
> For example, if i use the scm:tag goal in my build definition, it would be nice to have something like this in my maven2 build definition:
> clean install scm:tag -Dusername=${scm.username} -Dpassword=${scm.password}
> In this case, continuum should substitute the configured scm username and password before executing the build.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Reopened: (CONTINUUM-1182) Pass configured scm username and password to execution of maven goals

Posted by "Jan Edelbroek (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/CONTINUUM-1182?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jan Edelbroek reopened CONTINUUM-1182:
--------------------------------------


Its not good to configure the scm username and password in the settings.xml, because it then can be read by other users. For me and our organisation it is very important that the scm username and password cannot be read by other users because only our build manager has certain rights to our SCM (which is Starteam in our case). Also in our organisation, the build environment is shared among different users, so storing the password in the settings.xml is not an option.
Therefore i need i way to use the scm username and password from continuum so that they can be used by a maven plugin.

I made a small change to continuum-core to get this to work. The idea behind this change is that the scm username and password are stored as environment variables in the shell where maven is executed. A maven plugin can then use these environment variables to configure the scm username and password.

I hope that you adopt this change in the next release of continuum.

The diff file is shown below and made against the 1.1-SNAPSHOT version, date 2007-04-05.

Index: H:/workspaces/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/utils/shell/ShellCommandHelper.java
===================================================================
--- H:/workspaces/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/utils/shell/ShellCommandHelper.java	(revision 525924)
+++ H:/workspaces/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/utils/shell/ShellCommandHelper.java	(working copy)
@@ -20,6 +20,7 @@
  */
 
 import java.io.File;
+import org.apache.maven.continuum.model.project.Project;
 
 /**
  * @author <a href="mailto:trygvis@inamo.no">Trygve Laugst&oslash;l</a>
@@ -30,14 +31,14 @@
     String ROLE = ShellCommandHelper.class.getName();
 
     ExecutionResult executeShellCommand( File workingDirectory, String executable, String arguments, File output,
-                                         long idCommand )
+                                         Project project )
         throws Exception;
 
     ExecutionResult executeShellCommand( File workingDirectory, String executable, String[] arguments, File output,
-                                         long idCommand )
+                                         Project project )
         throws Exception;
 
-    boolean isRunning( long idCommand );
+    boolean isRunning( Project project );
 
-    void killProcess( long idCommand );
+    void killProcess( Project project );
 }
Index: H:/workspaces/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/utils/shell/DefaultShellCommandHelper.java
===================================================================
--- H:/workspaces/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/utils/shell/DefaultShellCommandHelper.java	(revision 525924)
+++ H:/workspaces/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/utils/shell/DefaultShellCommandHelper.java	(working copy)
@@ -24,6 +24,7 @@
 import org.codehaus.plexus.util.cli.Commandline;
 import org.codehaus.plexus.util.cli.StreamConsumer;
 import org.codehaus.plexus.util.cli.WriterStreamConsumer;
+import org.apache.maven.continuum.model.project.Project;
 
 import java.io.File;
 import java.io.FileWriter;
@@ -45,8 +46,12 @@
     // ShellCommandHelper Implementation
     // ----------------------------------------------------------------------
 
+    public static final String SCM_USERNAME = "CONTINUUM.PROJECT.SCM.USERNAME";
+    public static final String SCM_PASSWORD = "CONTINUUM.PROJECT.SCM.PASSWORD";
+
+
     public ExecutionResult executeShellCommand( File workingDirectory, String executable, String arguments, File output,
-                                                long idCommand )
+                                                Project project  )
         throws Exception
     {
         Commandline cl = new Commandline();
@@ -55,11 +60,11 @@
 
         argument.setLine( arguments );
 
-        return executeShellCommand( workingDirectory, executable, argument.getParts(), output, idCommand );
+        return executeShellCommand( workingDirectory, executable, argument.getParts(), output, project );
     }
 
     public ExecutionResult executeShellCommand( File workingDirectory, String executable, String[] arguments,
-                                                File output, long idCommand )
+                                                File output, Project project )
         throws Exception
     {
         // ----------------------------------------------------------------------
@@ -68,12 +73,17 @@
 
         Commandline cl = new Commandline();
 
-        cl.setPid( idCommand );
+        cl.setPid( project.getId() );
 
         cl.addSystemEnvironment();
 
         cl.addEnvironment( "MAVEN_TERMINATE_CMD", "on" );
 
+        // Store the scm username and password as environment variables, so that they can be used
+        // by the executable, such as maven
+        cl.addEnvironment(SCM_USERNAME, project.getScmUsername());
+        cl.addEnvironment(SCM_PASSWORD, project.getScmPassword());
+
         cl.setExecutable( executable );
 
         cl.setWorkingDirectory( workingDirectory.getAbsolutePath() );
@@ -111,13 +121,13 @@
         return new ExecutionResult( exitCode );
     }
 
-    public boolean isRunning( long idCommand )
+    public boolean isRunning( Project project )
     {
-        return CommandLineUtils.isAlive( idCommand );
+        return CommandLineUtils.isAlive( project.getId() );
     }
 
-    public void killProcess( long idCommand )
+    public void killProcess( Project project )
     {
-        CommandLineUtils.killProcess( idCommand );
+        CommandLineUtils.killProcess( project.getId() );
     }
 }
Index: H:/workspaces/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java
===================================================================
--- H:/workspaces/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java	(revision 525924)
+++ H:/workspaces/continuum/trunk/continuum-core/src/main/java/org/apache/maven/continuum/execution/AbstractBuildExecutor.java	(working copy)
@@ -190,7 +190,7 @@
         try
         {
             ExecutionResult result = shellCommandHelper.executeShellCommand( workingDirectory, actualExecutable,
-                                                                             arguments, output, project.getId() );
+                                                                             arguments, output, project );
 
             getLogger().info( "Exit code: " + result.getExitCode() );
 
@@ -219,12 +219,12 @@
 
     public boolean isBuilding( Project project )
     {
-        return shellCommandHelper.isRunning( project.getId() );
+        return shellCommandHelper.isRunning( project );
     }
 
     public void killProcess( Project project )
     {
-        shellCommandHelper.killProcess( project.getId() );
+        shellCommandHelper.killProcess( project );
     }
 
     public List getDeployableArtifacts( File workingDirectory, BuildDefinition buildDefinition )


> Pass configured scm username and password to execution of maven goals
> ---------------------------------------------------------------------
>
>                 Key: CONTINUUM-1182
>                 URL: http://jira.codehaus.org/browse/CONTINUUM-1182
>             Project: Continuum
>          Issue Type: Improvement
>          Components: Core system
>            Reporter: Jan Edelbroek
>
> It's possible to configure a scm username and password. Continuum uses this to update the sourcecode from the scm before the actual build takes place.
> Because of this feature, i don't have to configure this in my project pom for maven2.
> It would be nice if i could use these username and password also for executing maven goals.
> For example, if i use the scm:tag goal in my build definition, it would be nice to have something like this in my maven2 build definition:
> clean install scm:tag -Dusername=${scm.username} -Dpassword=${scm.password}
> In this case, continuum should substitute the configured scm username and password before executing the build.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (CONTINUUM-1182) Pass configured scm username and password to execution of maven goals

Posted by "Emmanuel Venisse (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/CONTINUUM-1182?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_88325 ] 

Emmanuel Venisse commented on CONTINUUM-1182:
---------------------------------------------

and configure the plugin with them

> Pass configured scm username and password to execution of maven goals
> ---------------------------------------------------------------------
>
>                 Key: CONTINUUM-1182
>                 URL: http://jira.codehaus.org/browse/CONTINUUM-1182
>             Project: Continuum
>          Issue Type: Improvement
>          Components: Core system
>            Reporter: Jan Edelbroek
>
> It's possible to configure a scm username and password. Continuum uses this to update the sourcecode from the scm before the actual build takes place.
> Because of this feature, i don't have to configure this in my project pom for maven2.
> It would be nice if i could use these username and password also for executing maven goals.
> For example, if i use the scm:tag goal in my build definition, it would be nice to have something like this in my maven2 build definition:
> clean install scm:tag -Dusername=${scm.username} -Dpassword=${scm.password}
> In this case, continuum should substitute the configured scm username and password before executing the build.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (CONTINUUM-1182) Pass configured scm username and password to execution of maven goals

Posted by "Brett Porter (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/CONTINUUM-1182?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brett Porter updated CONTINUUM-1182:
------------------------------------

    Patch Submitted: [Yes]

> Pass configured scm username and password to execution of maven goals
> ---------------------------------------------------------------------
>
>                 Key: CONTINUUM-1182
>                 URL: http://jira.codehaus.org/browse/CONTINUUM-1182
>             Project: Continuum
>          Issue Type: Improvement
>          Components: Core system
>            Reporter: Jan Edelbroek
>             Fix For: Future
>
>         Attachments: continuum-diff.txt
>
>
> It's possible to configure a scm username and password. Continuum uses this to update the sourcecode from the scm before the actual build takes place.
> Because of this feature, i don't have to configure this in my project pom for maven2.
> It would be nice if i could use these username and password also for executing maven goals.
> For example, if i use the scm:tag goal in my build definition, it would be nice to have something like this in my maven2 build definition:
> clean install scm:tag -Dusername=${scm.username} -Dpassword=${scm.password}
> In this case, continuum should substitute the configured scm username and password before executing the build.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (CONTINUUM-1182) Pass configured scm username and password to execution of maven goals

Posted by "Jan Edelbroek (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/CONTINUUM-1182?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jan Edelbroek updated CONTINUUM-1182:
-------------------------------------

    Attachment: continuum-diff.txt

In the previous comment, i included the patch in the comment, which i think was not a good idea, so i add the patch as file too.

> Pass configured scm username and password to execution of maven goals
> ---------------------------------------------------------------------
>
>                 Key: CONTINUUM-1182
>                 URL: http://jira.codehaus.org/browse/CONTINUUM-1182
>             Project: Continuum
>          Issue Type: Improvement
>          Components: Core system
>            Reporter: Jan Edelbroek
>         Attachments: continuum-diff.txt
>
>
> It's possible to configure a scm username and password. Continuum uses this to update the sourcecode from the scm before the actual build takes place.
> Because of this feature, i don't have to configure this in my project pom for maven2.
> It would be nice if i could use these username and password also for executing maven goals.
> For example, if i use the scm:tag goal in my build definition, it would be nice to have something like this in my maven2 build definition:
> clean install scm:tag -Dusername=${scm.username} -Dpassword=${scm.password}
> In this case, continuum should substitute the configured scm username and password before executing the build.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira