Package naming problem


Let’s say I have a package named “foobar”. In a sister directory, I have another package named “foobar.test”, which contains many test drivers for the foobar package. The foobar.test package imports from the foobar package, but the two packages are otherwise unrelated.

That arrangement, albeit perhaps unconventional, has worked for me for several years, but now it is causing a problem. Normally I don’t want to import any of the test stuff into the main foobar package, but for debugging purposes I now want to import something temporarily.

The problem is that when I try to import from foobar.test into the foobar package, I get an error telling me that “object test is not a member of package foobar.”

Is there some syntactic trick I can use to import from this package without renaming it? I tried using quotes and braces but they didn’t work. Thanks.


Usually this should work. You mention your test package is “In a sister directory”. Is this a separate directory for tests from you build tool? If so, the files in there may be not in the class path when compiling the main sources.