I have a test project setup using model with a library named ‘main’ and a testSuite named ‘test’. ‘main’ has two packages with one class in each with one being exported in the api and the other not exported. How can I give ‘test’ access to the non-exported class? Declaring dependencies on library ‘main’ compiles it against the api jar and thus doesn’t work.
The user guide has an example covering tests, but it doesn’t use any classes from the library: https://docs.gradle.org/current/userguide/java_software.html#sec:testing_java_libraries
It would appear $ is only a problem if the model is defined in a subproject. If it is in the main project, it works just fine.
Edit: Putting the model in the subproject’s build.gradle also works fine.
Edit:
Are subprojects not a part of the new software model?
Edit:
Seems it’s the old ‘java’ plugin that is giving me trouble. The ‘eclipse’ plugin doesn’t seem to want to create java projects without it, and the ‘java’ plugin adds a task to the ‘build’ task, making ‘build’ depend on both dependencies declared in the outermost scope of the build.gradle file, while the new component plugins require dependencies to be declared inside the model as well. Declaring dependencies twice seems to fix the problem.