testSuites not seeing non-api classes

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

model {
    components {
        main(JvmLibrarySpec)
            api {
                exports 'lib'
                //exports 'lib.impl'
            }
        }
    }
    testSuites {
        test(JUnitTestSuiteSpec) {
            jUnitVersion '4.12'
            dependencies {
                library 'main'
            }
        }
    }
}

The user guide mentions testing $.components.main, but that throws “Invalid variable name. Must include a letter but only found: $”

Topic How to "read" component model information in a Copy task? mentions that the $.components works in Gradle 2.9, but not in 3.0. Is there a new way to do it in Gradle 3.0?

Nightly 3.1-20160820000021+0000 also does not like $.
I can’t test 2.9 because it does not seem to include junit-test-suite.
2.14 does not accept $.

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.

Bad (top level build.gradle):

project(':main') {
    model {
        components {
            main(JvmLibrarySpec)
        }
        testSuites {
            test(JUnitTestSuiteSpec) {
                jUnitVersion '4.12'
                testing $.components.main
            }
        }
    }
}

Good (subproject build.gradle):

model {
    components {
        main(JvmLibrarySpec)
    }
    testSuites {
        test(JUnitTestSuiteSpec) {
            jUnitVersion '4.12'
            testing $.components.main
        }
    }
}

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.