xref: /Lucene/help/forbiddenApis.txt (revision 74e88deba78ea40f81c3072d6e014903773f4e92)
1Forbidden API rules
2===================
3
4Uwe's excellent forbidden API checker is applied as part of 'check'
5task. The rules for each project are sourced dynamically based on the
6actual set of dependencies.
7
8If a given project has a dependency on an artifact called "foo.bar:baz"
9then all of these rule files will be applied (all paths relative
10to: gradle/validation/forbidden-apis/).
11
12defaults.all.txt
13defaults.[project].txt
14foo.bar.baz.all.txt
15foo.bar.baz.[project].txt
16
17Note that the "defaults" can't reference any JARs other than Java's
18runtime.
19
20Example
21-------
22
23We'd like to prevent people from using Guava's
24com.google.common.base.Charsets class. The rule would be:
25
26@defaultMessage Use java.nio.charset.StandardCharsets instead
27com.google.common.base.Charsets
28
29and we would place this rule in this file:
30
31gradle/validation/forbidden-apis/com.google.guava.guava.all.txt
32
33From now on, if *any* module depends on this library, it will
34automatically pick up the rule and enforce it.
35