Revamp support for building third-party apps via maven
- Publish onos-dependencies (autogenerated from deps.json). With most
3rd-party dependencies listed as <dependencyManagement> to avoid
version conflicts, and a minimal set listed as <dependencies> to
simplify child poms. Similarly, we provide a number of plugins already
configured as <pluginManagement> to support the whole life-cycle of
apps (from build, to reporting and release).
- Update Maven plugins to work with JDK 11 (checkstyle, pmd, etc.)
- Publish onos-build-conf (with common checkstyle and pmd confs)
- Removed unused checkstyle code
- Fix OSGi version mismatch in deps.json to consistently depend on
release 6 (the one supported by Karaf 4)
- Update/simplify archetypes to use onos-dependencies as the parent pom
Change-Id: Ic09b34e13fb49eb3d96df623b53a3617bbf7b7e4
diff --git a/tools/build/conf/src/main/resources/onos/checkstyle-mvn.xml b/tools/build/conf/src/main/resources/onos/checkstyle-mvn.xml
index a236f73..fcad23f 100644
--- a/tools/build/conf/src/main/resources/onos/checkstyle-mvn.xml
+++ b/tools/build/conf/src/main/resources/onos/checkstyle-mvn.xml
@@ -115,6 +115,14 @@
<property name="message" value="javafx classes are not supported by all JDKs."/>
</module>
+ <!-- Don't allow usage of RuntimeException -->
+ <module name="RegexpSingleline">
+ <property name="format" value="throw[ ]*new[ ]*RuntimeException"/>
+ <property name="minimum" value="0"/>
+ <property name="maximum" value="0"/>
+ <property name="message" value="Don't throw generic exception types"/>
+ </module>
+
<!-- Checks for Headers -->
<!-- See http://checkstyle.sf.net/config_header.html -->
<!-- <module name="Header"> -->
@@ -122,12 +130,6 @@
<!-- <property name="fileExtensions" value="java"/> -->
<!-- </module> -->
- <module name="RegexpHeader">
- <!-- The following line is different for maven due to how the maven checkstyle plugin works -->
- <property name="headerFile" value="${checkstyle.header.file}"/>
- <property name="fileExtensions" value="java"/>
- </module>
-
<module name="SuppressWarningsFilter" />
<module name="SuppressWithPlainTextCommentFilter"/>
@@ -164,13 +166,13 @@
<property name="suppressLoadErrors" value="true"/>
</module>
<module name="JavadocType">
- <property name="severity" value="warning"/>
+ <property name="severity" value="ignore"/>
</module>
<module name="JavadocVariable">
<!-- Suppress check for private member Javadocs.
Possibly revist fixing these. -->
<property name="scope" value="public"/>
- <property name="severity" value="warning"/>
+ <property name="severity" value="ignore"/>
</module>
<module name="JavadocStyle"/>
<!-- @author tag should not be used -->
@@ -309,7 +311,7 @@
<module name="InterfaceIsType"/>
<module name="VisibilityModifier">
- <property name="severity" value="warning"/>
+ <property name="severity" value="ignore"/>
</module>
diff --git a/tools/build/conf/src/main/resources/onos/pmd.xml b/tools/build/conf/src/main/resources/onos/pmd.xml
index 156e6f9..19bac09 100644
--- a/tools/build/conf/src/main/resources/onos/pmd.xml
+++ b/tools/build/conf/src/main/resources/onos/pmd.xml
@@ -15,63 +15,59 @@
~ limitations under the License.
-->
<ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- name="ONOS Rules"
- xmlns="http://pmd.sf.net/ruleset/1.0.0"
- xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"
- xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd" >
+ name="ONOS Rules"
+ xmlns="http://pmd.sf.net/ruleset/1.0.0"
+ xsi:noNamespaceSchemaLocation="http://pmd.sf.net/ruleset_xml_schema.xsd"
+ xsi:schemaLocation="http://pmd.sf.net/ruleset/1.0.0 http://pmd.sf.net/ruleset_xml_schema.xsd">
<description>ONOS PMD rules</description>
- <rule ref="rulesets/java/unnecessary.xml" >
- <exclude name="UselessParentheses" />
+
+ <rule ref="category/java/errorprone.xml">
+ <exclude name="EmptyCatchBlock"/>
</rule>
- <rule ref="rulesets/java/basic.xml">
- <exclude name="EmptyCatchBlock"/>
+ <rule ref="category/java/errorprone.xml/EmptyCatchBlock">
+ <properties>
+ <property name="allowCommentedBlocks" value="true"/>
+ </properties>
</rule>
- <rule ref="rulesets/java/basic.xml/EmptyCatchBlock">
- <properties>
- <property name="allowCommentedBlocks" value="true"/>
- </properties>
- </rule>
- <rule ref="rulesets/java/unusedcode.xml">
- <!-- Explicit public keyword in interface methods is acceptable -->
- <exclude name="UnusedModifier" />
- </rule>
- <rule ref="rulesets/java/imports.xml"/>
+ <rule ref="category/java/bestpractices.xml"/>
<rule ref="rulesets/java/optimizations.xml">
- <exclude name="LocalVariableCouldBeFinal" />
- <exclude name="MethodArgumentCouldBeFinal" />
- <exclude name="AvoidInstantiatingObjectsInLoops" />
+ <exclude name="AvoidInstantiatingObjectsInLoops"/>
</rule>
<rule ref="rulesets/java/strings.xml">
- <exclude name="AvoidDuplicateLiterals" />
+ <exclude name="AvoidDuplicateLiterals"/>
</rule>
<rule ref="rulesets/java/braces.xml"/>
- <rule ref="rulesets/java/naming.xml">
- <exclude name="AvoidInstantiatingObjectsInLoops" />
- <exclude name="ShortClassName" />
- <exclude name="ShortMethodName" />
- <exclude name="ShortVariable" />
- <exclude name="LongVariable" />
+ <rule ref="category/java/codestyle.xml">
+ <!-- Explicit public keyword in interface methods is acceptable -->
+ <exclude name="UnnecessaryModifier"/>
+ <exclude name="UselessParentheses"/>
+ <exclude name="ShortClassName"/>
+ <exclude name="ShortMethodName"/>
+ <exclude name="ShortVariable"/>
+ <exclude name="LongVariable"/>
+ <exclude name="MethodArgumentCouldBeFinal"/>
+ <exclude name="LocalVariableCouldBeFinal"/>
</rule>
- <rule ref="rulesets/java/naming.xml/VariableNamingConventions">
- <properties>
- <!-- ONOS allows the name "log" for static final Loggers -->
- <property name="violationSuppressRegex" value=".*'log'.*"/>
- </properties>
+ <rule ref="category/java/codestyle.xml/VariableNamingConventions">
+ <properties>
+ <!-- ONOS allows the name "log" for static final Loggers -->
+ <property name="violationSuppressRegex" value=".*'log'.*"/>
+ </properties>
</rule>
<rule ref="rulesets/java/clone.xml"/>
<rule ref="rulesets/java/strictexception.xml"/>
<rule ref="rulesets/java/design.xml">
- <exclude name="GodClass" />
+ <exclude name="GodClass"/>
</rule>
<rule ref="rulesets/java/coupling.xml">
- <exclude name="LawOfDemeter" />
- <exclude name="ExcessiveImports" />
- <!-- Suppress Removed misconfigured rule warning -->
- <exclude name="LoosePackageCoupling" />
+ <exclude name="LawOfDemeter"/>
+ <exclude name="ExcessiveImports"/>
+ <!-- Suppress Removed misconfigured rule warning -->
+ <exclude name="LoosePackageCoupling"/>
</rule>
</ruleset>
diff --git a/tools/build/conf/src/main/resources/onos/suppressions.xml b/tools/build/conf/src/main/resources/onos/suppressions.xml
index c4e43e2..9f433a7 100644
--- a/tools/build/conf/src/main/resources/onos/suppressions.xml
+++ b/tools/build/conf/src/main/resources/onos/suppressions.xml
@@ -61,4 +61,6 @@
<!-- Suppressions for yangutils generated code -->
<suppress files="org.onosproject.yang.gen.v1.*" checks="Javadoc.*" />
+
+ <suppress files="ApiDocRegistrator.java" checks="JavadocPackage" />
</suppressions>