# systemProperties does not do anything

**URL:** <https://discuss.gradle.org/t/systemproperties-does-not-do-anything/1855>\
**Category:** Old Forum Archive\
**Created:** [August 2, 2012, 4:57pm UTC](https://discuss.gradle.org/t/systemproperties-does-not-do-anything/1855 "2012-08-02T16:57:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fx\_thoorens](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/fx_thoorens/32/468_2.png) [@fx\_thoorens](https://discuss.gradle.org/u/fx_thoorens)\
**Post date:** [August 2, 2012, 4:57pm UTC](https://discuss.gradle.org/t/systemproperties-does-not-do-anything/1855/1 "2012-08-02T16:57:00Z")

</div>

this script fails, anything wrong in it?

```gradle
apply plugin:'groovy'
  test {
        systemProperties 'test': 'test'
        assert 'test'==System.properties['test']
}

```

using gradle 1.0 on ubuntu, java 6 openjdk

Stacktrace:

```gradle
> assert 'test'==System.properties['test']
               |
      |
       |
               false
  |
       null
                        [java.runtime.name:OpenJDK Runtime Environment, jna.platform.library.path:/usr/lib:/lib, sun.boot.library.path:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/i386, java.vm.version:20.0-b12, java.vm.vendor:Sun Microsystems Inc., java.vendor.url:http://java.sun.com/, path.separator::, java.vm.name:OpenJDK Client VM, file.encoding.pkg:sun.io, user.country:US, sun.java.launcher:SUN_STANDARD, sun.os.patch.level:unknown, java.vm.specification.name:Java Virtual Machine Specification, user.dir:/home/ubuntu/test, java.runtime.version:1.6.0_24-b24, java.awt.graphicsenv:sun.awt.X11GraphicsEnvironment, java.endorsed.dirs:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/endorsed, os.arch:i386, java.io.tmpdir:/tmp, line.separator:
                        , org.gradle.appname:gradle, java.vm.specification.vendor:Sun Microsystems Inc., os.name:Linux, jna.boot.library.path:/home/ubuntu/.gradle/jna, sun.jnu.encoding:UTF-8, java.library.path:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/i386/client:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/i386:/usr/lib/jvm/java-6-openjdk-i386/jre/../lib/i386:/usr/java/packages/lib/i386:/usr/lib/i386-linux-gnu/jni:/lib/i386-linux-gnu:/usr/lib/i386-linux-gnu:/usr/lib/jni:/lib:/usr/lib, java.class.version:50.0, java.specification.name:Java Platform API Specification, sun.management.compiler:HotSpot Client Compiler, os.version:3.2.0-27-generic, user.home:/home/ubuntu, user.timezone:Europe/Paris, java.awt.printerjob:sun.print.PSPrinterJob, java.specification.version:1.6, file.encoding:UTF-8, user.name:ubuntu, java.class.path:/home/ubuntu/Applications/gradle-1.0/lib/gradle-launcher-1.0.jar, java.vm.specification.version:1.0, sun.arch.data.model:32, sun.java.command:org.gradle.launcher.GradleMain test, java.home:/usr/lib/jvm/java-6-openjdk-i386/jre, java.specification.vendor:Sun Microsystems Inc., user.language:en, java.vm.info:mixed mode, sharing, java.version:1.6.0_24, java.ext.dirs:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/ext:/usr/java/packages/lib/ext, sun.boot.class.path:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/resources.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/rt.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/sunrsasign.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/jsse.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/jce.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/charsets.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/netx.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/plugin.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/rhino.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/lib/modules/jdk.boot.jar:/usr/lib/jvm/java-6-openjdk-i386/jre/classes, java.vendor:Sun Microsystems Inc., file.separator:/, java.vendor.url.bug:http://java.sun.com/cgi-bin/bugreport.cgi, sun.io.unicode.encoding:UnicodeLittle, sun.cpu.endian:little, sun.desktop:gnome, sun.cpu.isalist:]

```

---

<div class="post-metadata">

**Author:** ![luke\_daley](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/luke_daley/32/9890_2.png) [@luke\_daley](https://discuss.gradle.org/u/luke_daley)\
**Post date:** [August 2, 2012, 6:07pm UTC](https://discuss.gradle.org/t/systemproperties-does-not-do-anything/1855/2 "2012-08-02T18:07:00Z")

</div>

You are setting the system properties for the forked JVM process that the tests run in, not the JVM the build is running in.

---

<div class="post-metadata">

**Author:** ![fx\_thoorens](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/fx_thoorens/32/468_2.png) [@fx\_thoorens](https://discuss.gradle.org/u/fx_thoorens)\
**Post date:** [August 2, 2012, 7:30pm UTC](https://discuss.gradle.org/t/systemproperties-does-not-do-anything/1855/3 "2012-08-02T19:30:00Z")

</div>

ok, got it thanks. so if i use

```gradle
systemProp.test=test

```

in gradle.properties, that property will be available for gradle jvm process but not for the forked test process, which means that i have to bind it again like

```gradle
test {
        systemProperties 'test': System.properties['test']
}

```

Still find it weird, but it’s logical

---

<div class="post-metadata">

**Author:** ![Rene](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/rene/32/8082_2.png) [@Rene](https://discuss.gradle.org/u/Rene)\
**Post date:** [August 2, 2012, 7:34pm UTC](https://discuss.gradle.org/t/systemproperties-does-not-do-anything/1855/4 "2012-08-02T19:34:00Z")

</div>

Hey, in another thread ([http://forums.gradle.org/gradle/topics/passing\_system\_properties\_to\_test\_task](http://forums.gradle.org/gradle/topics/passing_system_properties_to_test_task)) I provided an example of how to implement reusage of system properties with a custom plugin. maybe that helps.

cheers, René

---

<div class="post-metadata">

**Author:** ![fx\_thoorens](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/fx_thoorens/32/468_2.png) [@fx\_thoorens](https://discuss.gradle.org/u/fx_thoorens)\
**Post date:** [August 2, 2012, 7:41pm UTC](https://discuss.gradle.org/t/systemproperties-does-not-do-anything/1855/5 "2012-08-02T19:41:00Z")

</div>

yes sounds something like that! thanks for the hint!
