tags:

views:

92

answers:

3

Explanation: Say package A is always built first and then package B. I need to configure my eclipse workspace such that it mimics the build environment and shows compilation errors when sources in package A refer package B. Is this possible? If yes, how?

+3  A: 

You'd need to build them as separate projects, with project B referring to project A but not the other way round.

Jon Skeet
Thank you. But is there another alternative that involves only one project?
Vivek Kodira
Not that I'm aware of. If you've got a dependency barrier that you don't want to be crossed, that shouts "multiple projects" to me. If you don't want that dependency barrier, fix your build process to build both packages together.
Jon Skeet
No, in this case, there are several such packages - it wouldn't make sense to create as many projects but I do need to maintain the dependency barrier.
Vivek Kodira
Hmm... admittedly I obviously can't see your code, but it seems to me that you really should have as many projects as you've got separate layers which need dependency separation.
Jon Skeet
+1  A: 

Take a look to: Arquitecture Rules or Macker

These tools are able to warn you when some rule is broken. They both support the rule "some package should not invoke some other package".

I do not know if there is an eclipse plugin for any of them, sorry.

Banengusk
+2  A: 

If you want even tighter enforcement, you can make your projects OSGi bundles/Eclipse plugins. This allows you to specify which packages are exported from a bundle, and you can even specify that only specific bundles can access certain packages.

Scott Stanchfield