Analyze Dependencies

hi.

I have this problem with the dependency analyzer. I want to enter a rule for checking that the classes in an api dir do not use any classes outside this api dir... but it invariably includes java.* classes as part of the check. So, obviously every class in my api violates the rule.

Trying to explicitly remove java.* from the scope does not seem to help. here is the rule as I have it:

com.abs..* && !com.abs.api..*

in other words: Everything that is not in my api but at least in my root package. I have also tried adding " && !java.*" explixcitly but without any success...

... any ideas.

Florian Hehlen

6 comments
Comment actions Permalink

Florian Hehlen wrote:

hi.

I have this problem with the dependency analyzer. I want to enter a rule for checking that the classes in an api dir do not use any classes outside this api dir... but it invariably includes java.* classes as part of the check. So, obviously every class in my api violates the rule.

Trying to explicitly remove java.* from the scope does not seem to help. here is the rule as I have it:

com.abs..* && !com.abs.api..*

in other words: Everything that is not in my api but at least in my root package. I have also tried adding " && !java.*" explixcitly but without any success...

.. any ideas.

Florian Hehlen


You can refine the scope using scope type (like lib, test, src) or specify a module pattern. Like "lib:.." is whatever
found in libraries or "[modulename]:.." is everything inside module named "modulename". Yet another hint: you can add
something to the scope by using || rather than excluding by &&.

In your case the rule would be as follows:
Deny usages of "!(com.abs.api..* || lib:..)" in "com.abs.api..*" if I caught the goal right.

--
Maxim Shafirov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

Is there documentation on all this? (Or will there be?)

R

0
Comment actions Permalink

Robert S. Sfeir wrote:

Is there documentation on all this? (Or will there be?)

R

Hmm, Help button in Dependency Validation dialog (the stuff were you're entering the rules)...

--
Maxim Shafirov
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Comment actions Permalink

Heh, there's stuff in there. Thanks. Sorry some of the docs were not updated so I didn't bother looking there.

R

0
Comment actions Permalink

thamnks.

I will try these out when i have a chance. But i still don't understand why the java.* are being included when I specifically start by including only stuff in com.abs..*.

will report back later.

Florian

0
Comment actions Permalink

thanks for the tip... it has certainly helped.

But the conclusion here is that you have to work these rules by hand and not really trust the tree view... cause I found many ways to right rules that create the same tree view yet cause porblems.

now i am just left with a couple of classes outside my API that i can't seem to have included as part of the api rule. But, maybe i should ask myself why I am allowing that one exception to the rule!!!! :)

Florian

0

Please sign in to leave a comment.