Tricks and Tipps
check java compiler for the n00bs
Adding expanding SourceSets
see discussion in http://stackoverflow.com/a/37882006/529977
I'm still not sure, it's 100% correct ... I expect there are side effects of this solution
Expanding (test) SourceSets in Multi-Project configuration
- have a multi-project gradle configuration
- have a some sort "library"
can include the "library" in your other subproject by simply add this dependency:
which automatically adds the compileOutput from this project library to your project
can't use the same bechanism for
testCompile, so this won't work:
but just adds all dependencies from
library-subproject-name.testCompileto your testCompile, missing the testOutput / classes themself.
so: you can't define some sort of "base test classes" or "JUnit Categories"
Reading https://docs.gradle.org/current/userguide/java_plugin.html you might think,
compile project(':library-subproject-name') is the same as
compile … configuration: 'default') i.e.
… configuration: 'runtime'
testCompile … configuration: 'testCompile' or even
testCompile … configuration: 'testRuntime' should do the same.
And you're totally right!
Except the fact: testCompile doesn't provide an artifact so you just get the dependencies on test* but not test* artifact itself!!!
This is where some tricks come in:
which is exactly what is described in Example 26.26 https://docs.gradle.org/current/userguide/multi_project_builds.html#javaWithCustomConf
- long story short: you have to define a jar for your test out. To achive this simply you might use this plugin: plugins.gradle.org:com.github.hauner.jarTest
- see also https://discuss.gradle.org/t/gradle-test-classes-needed-in-another-sub-project/13365/2
- have a look at https://docs.gradle.org/current/userguide/artifact_dependencies_tutorial.html in general
IntelliJ IDEa not sets languageLevel correct, see details via https://gist.github.com/childnode/12757be70b2895a1eed0
- "How to work with gradle wrapper, init script, multi project and best with idea" @ stackoverflow.com/35633149