I'll try...
I assume you got an uploadArchives configuration block (uploadArchives {...})
in which you prompt for the username+password combo.
I think any code within this block will always execute as part of the
configuration phase which seems to be your problem.
So if you only want the prompt to occur upon running the uploadArchives task
(not to be confused with the configuration block) then you would need to hook
into the lifecycle of that task.
Now I'm no expert on this but I believe you can add closures to be executed
upon a certain task through the uploadArchives << {...} notation. However in
this case that would probably prompt you after the uploadArchives task
installed by the maven plugin is executed.
Maybe, though I'm not sure how, you can add your custom code to be added before
any already installed tasks. At least the Task API seems to suggest you can
with Task.doFirst(Action). See
http://www.gradle.org/current/docs/javadoc/org/gradle/api/Task.html
Hope this helps and perhaps someone with more knowledge of manipulating task
execution could shed some more light on this.
Regards,
Sebastian
On 17 Jul 2011, at 15:41, Hani Suleiman wrote:
> Hi all,
>
> I'd like to prompt the user for a username/password when uploading an archive.
>
> I can define a task that prompts the user. The problem I'm running into is a
> side effect of the configuration vs evaluation passes that Gradle does. What
> happens now seems to be:
>
> - Configuration pass evaluates the uploadArchives credentials
> - Prompt task is invoked
>
> If I move the prompt task into uploadArchives, then it's always performed
> (even when not running uploadArchives) as part of the configuration pass.
>
> If this isn't clear, I can send the code examples.
>
> What I'd like is to be able to prompt the user for credentials only when
> uploadArchives is invoked, and have those credentials used for the upload.
> Any suggestions on how best to accomplish that?
>
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email