Discussion:
Unsuccessfully trying to set environment variables for a unit test ????
Alexander von Zitzewitz
2012-09-27 19:54:06 UTC
Permalink
I have the following test task in gradle 1.2

task("testMacosx32", type: org.gradle.api.tasks.testing.Test)
{
systemProperty "INCLUDE", "$project.projectDir/src/test/cpp/win64/VC10/include;$project.projectDir/src/test/cpp/win64/WINSDK/include"
environment("INCLUDE", "$project.projectDir/src/test/cpp/win64/VC10/include;$project.projectDir/src/test/cpp/win64/WINSDK/include")
allJvmArgs = ["-d32", "-Djava.library.path=$project.buildDir/jnilib/Macosx32", "-DINCLUDE=$project.projectDir/src/test/cpp/win64/VC10/include;$project.projectDir/src/test/cpp/win64/WINSDK/include"]
dependsOn("compileMacosx32")
}


As you can see I am trying to set the environment variable "INCLUDE" (first I tried environment only, then I added systemProperty)

In the test a groovy script trues to access the variable and fails, it is not defined !

What am I doing wrong, I am trying to figure that out since two days ;-(

Any help would be highly appreciated


Best regards

Alexander von Zitzewitz

hello2morrow Inc.
1 (877) 294-6327
Luke Daley
2012-09-30 08:06:46 UTC
Permalink
Post by Alexander von Zitzewitz
I have the following test task in gradle 1.2
task("testMacosx32", type: org.gradle.api.tasks.testing.Test)
{
systemProperty "INCLUDE", "$project.projectDir/src/test/cpp/win64/VC10/include;$project.projectDir/src/test/cpp/win64/WINSDK/include"
environment("INCLUDE", "$project.projectDir/src/test/cpp/win64/VC10/include;$project.projectDir/src/test/cpp/win64/WINSDK/include")
allJvmArgs = ["-d32", "-Djava.library.path=$project.buildDir/jnilib/Macosx32", "-DINCLUDE=$project.projectDir/src/test/cpp/win64/VC10/include;$project.projectDir/src/test/cpp/win64/WINSDK/include"]
dependsOn("compileMacosx32")
}
As you can see I am trying to set the environment variable "INCLUDE" (first I tried environment only, then I added systemProperty)
In the test a groovy script trues to access the variable and fails, it is not defined !
What am I doing wrong, I am trying to figure that out since two days ;-(
Any help would be highly appreciated
That looks right to me. I can't reproduce your problem.

Perhaps you could send a sample project that exhibits this problem.

PS. The user mailing list has been deprecated. The preferred mechanism for reporting problems/answering questions is via http://forums.gradle.org
--
Luke Daley
Principal Engineer, Gradleware
http://gradleware.com
Loading...