ctubbsii commented on a change in pull request #206: Checkstyle import control blog post. Fixes #149 URL: https://github.com/apache/accumulo-website/pull/206#discussion_r343388300
########## File path: _posts/blog/2019-11-04-checkstyle-import-control.md ########## @@ -0,0 +1,93 @@ +--- +title: "Checking API use" +--- + +Accumulo follows [SemVer] across versions with the declaration of a public API. Code not in the public API should be +considered unstable, at risk of changing between versions. The packages included in the public API are [listed on the website][api] +but may not always be considered when developing using Accumulo code. This blog post explains how to setup a Maven project +to automatically detect when Accumulo 2.0 code used in the project is outside of the public API. + +## Checkstyle Plugin + +First add the checkstyle Maven plugin to your pom. + +```xml +<plugin> + <!-- This was added to ensure project only uses public API --> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-checkstyle-plugin</artifactId> + <version>3.1.0</version> + <configuration> + <configLocation>checkstyle.xml</configLocation> + </configuration> Review comment: > What is wrong with that? It's not necessarily "wrong"... but it can make it more difficult to run the checkstyle plugin with different configuration in separate executions. Moving the `<configuration/>` element and its contents to inside the `<execution/>` element will make it so that execution is specifically configured to do the import control checks, but it wouldn't affect any other executions of the checkstyle plugin the user may already have configured (or might want to configure later), such as additional checks in a separate execution defined in a profile, or executions run manually on the command-line, or independent executions in sibling modules in a multi-module project. In the case of sibling modules, it might be useful for the user to have separate import-control configs, each with their own `<import-control pkg="my.package.name.example">` settings for that specific module, rather than have one massive config file for all modules. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
