Sumit
Sumit

Reputation: 2264

Is there a way to restrict certain java imports via checkstyle or findbugs

We work on a project that depends on many other libraries. These libraries being in other libraries that we would rather not use in our project. But with many developers it is difficult to enforce what kind of libraries we can or cannot use in our project. Is there way in checkstyle or findbugs where we can check for certain imports say

import edu.emory.mathcs.backport.java.util.Arrays 

and raise a flag that such imports are not allowed (even though compiler won't complain since this library is part of our project via other library that we depend on.)

Upvotes: 6

Views: 2114

Answers (1)

Michal Kordas
Michal Kordas

Reputation: 10925

To restrict certain imports you can use any of these Checkstyle rules:

Upvotes: 5

Related Questions