This version is correct:

build.gradle:
task printProps << {
  // I'd use System.getProperty("Password") but it won't make a difference
  println System.properties["Password"] // Java equivalent:
System.getProperties().get("Password")
}

$ gradle -DPassword=test printProps

Give it another try. Maybe you just mixed something up.

--
Peter Niederwieser
Principal Engineer, Gradleware 
http://gradleware.com
Creator, Spock Framework 
http://spockframework.org
Twitter: @pniederw


Mike Hoff wrote:
> 
> Hello everyone,
> I didn't figure out how to set and address a System Property with -D
> 
> I tried in the command line:
> 
>  gradle -DPassword=test
> 
> and also tried:
> 
>  gradle -Dorg.gradle.UploadTask.Password=test
> 
> (UploadTask is the folder where the build script lies)
> 
> and also just tried:
> 
>  gradle -Dorg.gradle.project.Password=test
> 
> And my Build Script had the print task just to check if it worked:
> 
> task printProps << {
> 
>       println System.properties['Password']
>       
> }
> 
> But the output was just:
> 
> :UploadTask Mike$ gradle print
> :printProps
> null
> 
> 
> I also tried:
> 
> task printProps << {
> 
>       println Password        
> }
> in the Build Script, but the outcome was just:
> 
> * What went wrong:
> Execution failed for task ':printProps'.
> Cause: Could not find property 'Password' on task ':printProps'.
>  
> 
> I am sorry if that might be a stupid question, but I didn't figure out how
> I could work with that property and I am thankful for any help!
> 


--
View this message in context: 
http://gradle.1045684.n5.nabble.com/D-SystemProperty-tp4733742p4736399.html
Sent from the gradle-user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to