I'm afraid that's not possible using ImportControl.
The reason is that anything you can specify in an import-control.xml refers to packages, but not to source folders or projects. Checkstyle does not know source folders or projects because it is IDE agnostic, and those are Eclipse constructs. import-control.xml also cannot refer to absolute file names, because Checkstyle does not know the absolute file names of the referenced classes.
One way out of this problem is to choose the forbidden packages so that they all contain a common component (like com.foo.FORBIDDEN.pkg
). You could then forbid the use of the thusly tagged packages.
Also, you could write an Eclipse-aware Checkstyle check of your own. I did that once, and succeeded, but I can tell you it will be several days of work to do it right, even if you know what you're doing.