Skip to content

Commit b5f0714

Browse files
committed
Add $MODULE_DIR$ as default working dir for JUnit tests in IDEA through gradle idea module
1 parent 7b03d67 commit b5f0714

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

build.gradle

+13-3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,18 @@ idea {
3434
provider.node.component.find { it.@name == 'VcsDirectoryMappings' }.mapping.@vcs = 'Git'
3535
}
3636
}
37+
workspace {
38+
iws {
39+
withXml { xmlFile ->
40+
def runManager = xmlFile.asNode().component.find { it.@name == 'RunManager' }
41+
// setup JUnit's default run configuration
42+
def junitDefaults = runManager.configuration.find { it.@default == 'true' && it.@type == 'JUnit' }
43+
junitDefaults.option.find { it.@name == 'WORKING_DIRECTORY' }.replaceNode {
44+
option(name: 'WORKING_DIRECTORY', value: '$MODULE_DIR$')
45+
}
46+
}
47+
}
48+
}
3749
}
3850

3951
subprojects {
@@ -80,6 +92,4 @@ subprojects {
8092
}
8193
}
8294
}
83-
84-
85-
}
95+
}

0 commit comments

Comments
 (0)