Enable docs-linkcheck to validate the links
[docs.git] / docs / developer-guide / integrating-animal-sniffer-plugin-with-projects.rst
1 Integrating Animal Sniffer with OpenDaylight projects
2 =====================================================
3
4 This section provides information required to setup OpenDaylight projects with
5 the Maven's `Animal Sniffer plugin`_ for testing API compatibility with OpenJDK.
6
7
8 Steps to setup up animal sniffer plugin with your project
9 ---------------------------------------------------------
10
11 1. Clone odlparent and checkout the required branch. The example below uses
12    the branch 'origin/master/2.0.x'
13
14 .. code:: shell
15
16     git clone https://git.opendaylight.org/gerrit/odlparent
17     cd odlparent
18     git checkout origin/master/2.0.x
19
20 2. Modify the file `odlparent/pom.xml` to install the `Animal Sniffer plugin`_ as
21    shown in the below example or refer to the change `odlparent gerrit patch`_.
22
23 .. code:: xml
24
25     <plugin>
26       <groupId>org.codehaus.mojo</groupId>
27       <artifactId>animal-sniffer-maven-plugin</artifactId>
28       <version>1.16</version>
29       <configuration>
30           <signature>
31               <groupId>org.codehaus.mojo.signature</groupId>
32               <artifactId>java18</artifactId>
33               <version>1.0</version>
34           </signature>
35       </configuration>
36       <executions>
37           <execution>
38               <id>animal-sniffer</id>
39               <phase>verify</phase>
40               <goals>
41                   <goal>check</goal>
42               </goals>
43           </execution>
44           <execution>
45               <id>check-java-version</id>
46               <phase>package</phase>
47               <goals>
48                   <goal>build</goal>
49               </goals>
50               <configuration>
51                 <signature>
52                   <groupId>org.codehaus.mojo.signature</groupId>
53                   <artifactId>java18</artifactId>
54                   <version>1.0</version>
55                 </signature>
56               </configuration>
57           </execution>
58       </executions>
59     </plugin>
60
61 3. Run a `mvn clean install` in odlparent.
62
63 .. code:: shell
64
65     mvn clean install
66
67 4. Clone the respective project to be tested with the plugin. As shown in the
68    example in `yangtools gerrit patch`_, modify the relevant pom.xml files to
69    reference the version of odlparent which is checked-out. As shown in the example
70    below change the version to `2.0.6-SNAPSHOT` or the version of the
71    `2.0.x-SNAPSHOT` odlparent is checked out.
72
73 .. code::
74
75     <parent>
76         <groupId>org.opendaylight.odlparent</groupId>
77         <artifactId>odlparent</artifactId>
78         <version>2.0.6-SNAPSHOT</version>
79         <relativePath/>
80     </parent>
81
82 5. Run a `mvn clean install` in your project.
83
84 .. code:: shell
85
86     mvn clean install
87
88 6. Run `mvn animal-sniffer:check` on your project and fix any relevant issues.
89
90 .. code:: shell
91
92     mvn animal-sniffer:check
93
94 .. _odlparent gerrit patch: https://git.opendaylight.org/gerrit/64688/
95 .. _yangtools gerrit patch: https://git.opendaylight.org/gerrit/64781
96 .. _Animal Sniffer plugin: https://www.mojohaus.org/animal-sniffer/animal-sniffer-maven-plugin/examples/checking-signatures.html