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/deps/deps.json b/deps/deps.json
index da2e326..4cef8f0 100644
--- a/deps/deps.json
+++ b/deps/deps.json
@@ -228,7 +228,7 @@
"metrics-json": "mvn:io.dropwizard.metrics:metrics-json:3.2.2",
"minimal-json": "mvn:com.eclipsesource.minimal-json:minimal-json:0.9.4",
"minlog": "mvn:com.esotericsoftware:minlog:1.3.0",
- "io_netty_netty": "mvn:io.netty:netty:4.1.35.Final",
+ "io_netty_netty": "mvn:io.netty:netty:3.10.5.Final",
"io_netty_netty_buffer": "mvn:io.netty:netty-buffer:4.1.35.Final",
"io_netty_netty_codec": "mvn:io.netty:netty-codec:4.1.35.Final",
"io_netty_netty_common": "mvn:io.netty:netty-common:4.1.35.Final",
@@ -245,7 +245,7 @@
"objenesis": "mvn:org.objenesis:objenesis:2.6",
"openflowj": "mvn:org.onosproject:openflowj:3.2.1.onos",
"org.osgi.util.function": "mvn:org.osgi:org.osgi.util.function:1.1.0",
- "org.osgi.util.promise": "mvn:org.osgi:org.osgi.util.promise:1.1.0",
+ "org.osgi.util.promise": "mvn:org.osgi:org.osgi.util.promise:1.1.1",
"org.osgi.service.component": "mvn:org.osgi:org.osgi.service.component:1.4.0",
"org.osgi.service.component.annotations": "mvn:org.osgi:org.osgi.service.component.annotations:1.4.0",
"org.osgi.service.metatype.annotations": "mvn:org.osgi:org.osgi.service.metatype.annotations:1.4.0",
@@ -259,9 +259,8 @@
"org.apache.karaf.jaas": "mvn:org.apache.karaf.jaas:org.apache.karaf.jaas.modules:4.2.6",
"org.apache.karaf.system.core": "mvn:org.apache.karaf.system:org.apache.karaf.system.core:4.2.6",
"org.apache.servicemix.bundles.snmp4j": "mvn:org.apache.servicemix.bundles:org.apache.servicemix.bundles.snmp4j:2.3.4_1",
- "org.osgi.compendium": "mvn:org.osgi:org.osgi.compendium:5.0.0",
- "org.osgi.cmpn": "mvn:org.osgi:osgi.cmpn:7.0.0",
- "osgi-core": "mvn:org.osgi:org.osgi.core:5.0.0",
+ "org.osgi.cmpn": "mvn:org.osgi:osgi.cmpn:6.0.0",
+ "osgi-core": "mvn:org.osgi:org.osgi.core:6.0.0",
"reflectasm": "mvn:com.esotericsoftware:reflectasm:1.11.7",
"remotetea-oncrpc": "mvn:org.acplt.remotetea:remotetea-oncrpc:1.1.3",
"rrd4j": "mvn:org.rrd4j:rrd4j:3.1",
diff --git a/tools/build/bazel/BUILD b/tools/build/bazel/BUILD
index d819d63..26590a7 100644
--- a/tools/build/bazel/BUILD
+++ b/tools/build/bazel/BUILD
@@ -26,6 +26,13 @@
visibility = ["//visibility:public"],
)
+py_binary(
+ name = "dependencies_pom_generator",
+ srcs = ["dependencies_pom_generator.py"],
+ main = "dependencies_pom_generator.py",
+ visibility = ["//visibility:public"],
+)
+
java_binary(
name = "onos_yang_compiler",
main_class = "org.onosproject.yang.compiler.main.YangCompilerMain",
diff --git a/tools/build/bazel/dependencies_pom_generator.py b/tools/build/bazel/dependencies_pom_generator.py
new file mode 100755
index 0000000..f2df0c2
--- /dev/null
+++ b/tools/build/bazel/dependencies_pom_generator.py
@@ -0,0 +1,124 @@
+#!/usr/bin/env python
+# Copyright 2019-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+import argparse
+from datetime import datetime
+from xml.dom import minidom
+
+
+def resolve(mvn_coord):
+ mvn_pieces = mvn_coord.split(":")
+ if mvn_pieces[0] != "mvn":
+ raise ("Invalid Maven coordinate: %s" % mvn_coord)
+ return dict(
+ groupId=mvn_pieces[1],
+ artifactId=mvn_pieces[2],
+ version=mvn_pieces[-1],
+ name=mvn_coord,
+ )
+
+
+def xml_beautify(data):
+ beautified = '\n'.join([
+ l for l in
+ minidom.parseString(data).toprettyxml(indent=' ' * 4).split('\n')
+ if l.strip()])
+ return beautified
+
+
+def generate_pom(out_file, template_file, provided_deps, test_deps, deps, var_dict):
+ deps = {d: resolve(d) for d in deps}
+
+ dep_mgmt_template = """
+ <dependency>
+ <!-- {name} -->
+ <groupId>{groupId}</groupId>
+ <artifactId>{artifactId}</artifactId>
+ <version>{version}</version>
+ </dependency>"""
+
+ dep_template = """
+ <dependency>
+ <!-- {name} -->
+ <groupId>{groupId}</groupId>
+ <artifactId>{artifactId}</artifactId>
+ <scope>{scope}</scope>
+ </dependency>"""
+
+ mgmt_deps = sorted(deps.keys())
+ provided_deps.sort()
+ test_deps.sort()
+
+ with open(template_file, "r") as f:
+ lines = f.readlines()
+
+ new_lines = [
+ "<!-- Automatically generated on %s -->"
+ % datetime.now().strftime("%Y-%m-%d %H:%M:%S")
+ ]
+ for line in lines:
+ if "<!-- DEPS_MGMT -->" in line:
+ new_lines.extend([
+ dep_mgmt_template.format(**deps[x]) for x in mgmt_deps])
+ elif "<!-- DEPS -->" in line:
+ new_lines.extend([
+ dep_template.format(scope='provided', **deps[x])
+ for x in provided_deps])
+ new_lines.extend([
+ dep_template.format(scope='test', **deps[x])
+ for x in test_deps])
+ else:
+ for old, new in var_dict.items():
+ line = line.replace(old, new)
+ new_lines.append(line)
+
+ with open(out_file, 'w') as f:
+ f.write(xml_beautify("\n".join(new_lines)))
+
+
+if __name__ == '__main__':
+ parser = argparse.ArgumentParser()
+ parser.add_argument('-o', dest='out_file', type=str, action="store",
+ required=True, help="Path to output file")
+ parser.add_argument('-p', dest='template_file', type=str, action="store",
+ required=True, help="Path to pom template file")
+ parser.add_argument('-c', dest='provided_deps', metavar='PROVIDED_DEP',
+ type=str, nargs='+', default=[],
+ help='Maven coordinates to list with scope provided')
+ parser.add_argument('-t', dest='test_deps', metavar='TEST_DEP', type=str,
+ nargs='+', default=[],
+ help='Maven coordinates to list with scope test')
+ parser.add_argument('-d', dest='deps', metavar='DEP', type=str,
+ nargs='+', default=[],
+ help='Maven coordinates to list under <dependencyManagement>')
+ parser.add_argument('-v', dest='vars', metavar='VAR=value', type=str,
+ nargs='+', default=[],
+ help='Replace all instances of <!-- VAR --> with the given value')
+ args = parser.parse_args()
+
+ processed_vars = {}
+ for var in args.vars:
+ pieces = var.split('=')
+ if len(pieces) != 2:
+ raise ("Invalid var '%s'" % var)
+ processed_vars["<!-- %s -->" % pieces[0]] = pieces[1]
+
+ generate_pom(
+ out_file=args.out_file,
+ template_file=args.template_file,
+ provided_deps=args.provided_deps,
+ test_deps=args.test_deps,
+ deps=args.deps,
+ var_dict=processed_vars
+ )
diff --git a/tools/build/bazel/generate_workspace.bzl b/tools/build/bazel/generate_workspace.bzl
index 78d96c9..93fc83a 100644
--- a/tools/build/bazel/generate_workspace.bzl
+++ b/tools/build/bazel/generate_workspace.bzl
@@ -1,4 +1,4 @@
-# ***** This file was auto-generated at Thu, 29 Aug 2019 08:32:49 GMT. Do not edit this file manually. *****
+# ***** This file was auto-generated at Fri, 15 Nov 2019 18:42:10 GMT. Do not edit this file manually. *****
# ***** Use onos-lib-gen *****
load("//tools/build/bazel:variables.bzl", "ONOS_GROUP_ID", "ONOS_VERSION")
@@ -835,9 +835,9 @@
if "org_osgi_util_promise" not in native.existing_rules():
java_import_external(
name = "org_osgi_util_promise",
- jar_sha256 = "a679e25688e84e1739831e8716a2cc7acbf8348e22f1136d1988e34472e43756",
+ jar_sha256 = "4f85beccd281cc1a4e735bd266a0dd3db11651d3d0dde001e6bfa55dbdfdee83",
licenses = ["notice"],
- jar_urls = ["http://repo1.maven.org/maven2/org/osgi/org.osgi.util.promise/1.1.0/org.osgi.util.promise-1.1.0.jar"], )
+ jar_urls = ["http://repo1.maven.org/maven2/org/osgi/org.osgi.util.promise/1.1.1/org.osgi.util.promise-1.1.1.jar"], )
if "org_osgi_service_component" not in native.existing_rules():
java_import_external(
name = "org_osgi_service_component",
@@ -916,24 +916,18 @@
jar_sha256 = "68c5b7885fa9157813e01482ddbdfa1c63bb6743d98fd5dba8ce83904bfcf7f8",
licenses = ["notice"],
jar_urls = ["http://repo1.maven.org/maven2/org/apache/servicemix/bundles/org.apache.servicemix.bundles.snmp4j/2.3.4_1/org.apache.servicemix.bundles.snmp4j-2.3.4_1.jar"], )
- if "org_osgi_compendium" not in native.existing_rules():
- java_import_external(
- name = "org_osgi_compendium",
- jar_sha256 = "f1ef32cc1530f4e66aac606c24363b627ace4780a7737b045bfb3b908d801bcd",
- licenses = ["notice"],
- jar_urls = ["http://repo1.maven.org/maven2/org/osgi/org.osgi.compendium/5.0.0/org.osgi.compendium-5.0.0.jar"], )
if "org_osgi_cmpn" not in native.existing_rules():
java_import_external(
name = "org_osgi_cmpn",
- jar_sha256 = "8e6445afe1abb3dcd43c60c8cd6c0f15b052a8f4228812559ba521c5ce91db34",
+ jar_sha256 = "dbe06105a0e3e46bc88425b3d7c682a2d8b6bd055341913b6c37e998c00c9176",
licenses = ["notice"],
- jar_urls = ["http://repo1.maven.org/maven2/org/osgi/osgi.cmpn/7.0.0/osgi.cmpn-7.0.0.jar"], )
+ jar_urls = ["http://repo1.maven.org/maven2/org/osgi/osgi.cmpn/6.0.0/osgi.cmpn-6.0.0.jar"], )
if "osgi_core" not in native.existing_rules():
java_import_external(
name = "osgi_core",
- jar_sha256 = "b440c6bff286332afcf5cae067b606962e761c0df00e5fd8a746f0b31265619b",
+ jar_sha256 = "1c1bb435eb34cbf1f743653da38f604d45d53fbc95979053768cd3fc293cb931",
licenses = ["notice"],
- jar_urls = ["http://repo1.maven.org/maven2/org/osgi/org.osgi.core/5.0.0/org.osgi.core-5.0.0.jar"], )
+ jar_urls = ["http://repo1.maven.org/maven2/org/osgi/org.osgi.core/6.0.0/org.osgi.core-6.0.0.jar"], )
if "reflectasm" not in native.existing_rules():
java_import_external(
name = "reflectasm",
@@ -1449,7 +1443,7 @@
artifact_map["@objenesis//:objenesis"] = "mvn:org.objenesis:objenesis:jar:2.6"
artifact_map["@openflowj//:openflowj"] = "mvn:org.onosproject:openflowj:jar:3.2.1.onos"
artifact_map["@org_osgi_util_function//:org_osgi_util_function"] = "mvn:org.osgi:org.osgi.util.function:jar:1.1.0"
-artifact_map["@org_osgi_util_promise//:org_osgi_util_promise"] = "mvn:org.osgi:org.osgi.util.promise:jar:1.1.0"
+artifact_map["@org_osgi_util_promise//:org_osgi_util_promise"] = "mvn:org.osgi:org.osgi.util.promise:jar:1.1.1"
artifact_map["@org_osgi_service_component//:org_osgi_service_component"] = "mvn:org.osgi:org.osgi.service.component:jar:1.4.0"
artifact_map["@org_osgi_service_component_annotations//:org_osgi_service_component_annotations"] = "mvn:org.osgi:org.osgi.service.component.annotations:jar:1.4.0"
artifact_map["@org_osgi_service_metatype_annotations//:org_osgi_service_metatype_annotations"] = "mvn:org.osgi:org.osgi.service.metatype.annotations:jar:1.4.0"
@@ -1463,9 +1457,8 @@
artifact_map["@org_apache_karaf_jaas//:org_apache_karaf_jaas"] = "mvn:org.apache.karaf.jaas:org.apache.karaf.jaas.modules:jar:4.2.6"
artifact_map["@org_apache_karaf_system_core//:org_apache_karaf_system_core"] = "mvn:org.apache.karaf.system:org.apache.karaf.system.core:jar:4.2.6"
artifact_map["@org_apache_servicemix_bundles_snmp4j//:org_apache_servicemix_bundles_snmp4j"] = "mvn:org.apache.servicemix.bundles:org.apache.servicemix.bundles.snmp4j:jar:2.3.4_1"
-artifact_map["@org_osgi_compendium//:org_osgi_compendium"] = "mvn:org.osgi:org.osgi.compendium:jar:5.0.0"
-artifact_map["@org_osgi_cmpn//:org_osgi_cmpn"] = "mvn:org.osgi:osgi.cmpn:jar:7.0.0"
-artifact_map["@osgi_core//:osgi_core"] = "mvn:org.osgi:org.osgi.core:jar:5.0.0"
+artifact_map["@org_osgi_cmpn//:org_osgi_cmpn"] = "mvn:org.osgi:osgi.cmpn:jar:6.0.0"
+artifact_map["@osgi_core//:osgi_core"] = "mvn:org.osgi:org.osgi.core:jar:6.0.0"
artifact_map["@reflectasm//:reflectasm"] = "mvn:com.esotericsoftware:reflectasm:jar:1.11.7"
artifact_map["@remotetea_oncrpc//:remotetea_oncrpc"] = "mvn:org.acplt.remotetea:remotetea-oncrpc:jar:1.1.3"
artifact_map["@rrd4j//:rrd4j"] = "mvn:org.rrd4j:rrd4j:jar:NON-OSGI:3.1"
diff --git a/tools/build/bazel/pom_file.bzl b/tools/build/bazel/pom_file.bzl
index e3c5689..c291d4c 100644
--- a/tools/build/bazel/pom_file.bzl
+++ b/tools/build/bazel/pom_file.bzl
@@ -14,7 +14,7 @@
load("//tools/build/bazel:generate_workspace.bzl", "maven_coordinates")
-def _impl(ctx):
+def _impl_pom_file(ctx):
arguments = [
ctx.outputs.pom.path,
maven_coordinates(ctx.attr.artifact),
@@ -42,6 +42,47 @@
default = Label("//tools/build/bazel:pom_generator"),
),
},
- implementation = _impl,
+ implementation = _impl_pom_file,
+ outputs = {"pom": "%{name}.pom"},
+)
+
+def _impl_dependencies_pom(ctx):
+ arguments = [
+ "-o",
+ ctx.outputs.pom.path,
+ "-p",
+ ctx.file.pom_template.path,
+ "-d",
+ ] + [maven_coordinates(d.label) for d in ctx.attr.deps] + [
+ "-c",
+ ] + [maven_coordinates(d.label) for d in ctx.attr.deps_provided] + [
+ "-t",
+ ] + [maven_coordinates(d.label) for d in ctx.attr.deps_test] + [
+ "-v",
+ ] + ctx.attr.vars
+
+ ctx.actions.run(
+ inputs = [ctx.file.pom_template],
+ outputs = [ctx.outputs.pom],
+ progress_message = "Generating dependencies pom for %s" % ctx.attr.name,
+ arguments = arguments,
+ executable = ctx.executable._pom_generator,
+ )
+
+dependencies_pom = rule(
+ attrs = {
+ "pom_template": attr.label(allow_single_file = True),
+ "deps_provided": attr.label_list(),
+ "deps_test": attr.label_list(),
+ "deps": attr.label_list(),
+ "vars": attr.string_list(),
+ "_pom_generator": attr.label(
+ executable = True,
+ cfg = "host",
+ allow_files = True,
+ default = Label("//tools/build/bazel:dependencies_pom_generator"),
+ ),
+ },
+ implementation = _impl_dependencies_pom,
outputs = {"pom": "%{name}.pom"},
)
diff --git a/tools/build/bazel/variables.bzl b/tools/build/bazel/variables.bzl
index c0b2e69..121a529 100644
--- a/tools/build/bazel/variables.bzl
+++ b/tools/build/bazel/variables.bzl
@@ -4,3 +4,4 @@
ONOS_ORIGIN = "ONOS Community"
APP_PREFIX = ONOS_GROUP_ID + "."
DEFAULT_APP_CATEGORY = "Utility"
+DEFAULT_JAVA_VERSION = "11"
diff --git a/tools/build/conf/BUILD b/tools/build/conf/BUILD
index 1eb4fae..bf1effb 100644
--- a/tools/build/conf/BUILD
+++ b/tools/build/conf/BUILD
@@ -1,3 +1,5 @@
+load("//tools/build/bazel:pom_file.bzl", "pom_file")
+
checkstyle_source = "src/main/resources/onos/checkstyle.xml"
suppression_source = "src/main/resources/onos/suppressions.xml"
@@ -27,3 +29,9 @@
resources = glob(["src/main/resources/onos/**"]),
visibility = ["//visibility:public"],
)
+
+pom_file(
+ name = "onos-build-conf-pom",
+ artifact = "onos-build-conf",
+ visibility = ["//visibility:public"],
+)
diff --git a/tools/build/conf/src/main/java/org/onosproject/checkstyle/CheckstyleRunner.java b/tools/build/conf/src/main/java/org/onosproject/checkstyle/CheckstyleRunner.java
deleted file mode 100644
index ab1f7eb..0000000
--- a/tools/build/conf/src/main/java/org/onosproject/checkstyle/CheckstyleRunner.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright 2016-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.checkstyle;
-
-import com.puppycrawl.tools.checkstyle.Checker;
-import com.puppycrawl.tools.checkstyle.ConfigurationLoader;
-import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
-import com.puppycrawl.tools.checkstyle.PropertiesExpander;
-import com.puppycrawl.tools.checkstyle.api.AuditEvent;
-import com.puppycrawl.tools.checkstyle.api.AuditListener;
-import com.puppycrawl.tools.checkstyle.api.CheckstyleException;
-import com.puppycrawl.tools.checkstyle.api.Configuration;
-import org.onosproject.buckdaemon.BuckTask;
-import org.onosproject.buckdaemon.BuckTaskContext;
-
-import java.io.File;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-import java.util.stream.Collectors;
-
-import static com.google.common.base.Strings.isNullOrEmpty;
-
-/**
- * Buck task for executing checkstyle on the specified project files.
- */
-public class CheckstyleRunner implements BuckTask {
-
- private final Configuration config;
-
- public CheckstyleRunner(String configLocation, String suppressionLocation) {
- try {
- // create a configuration
- DefaultConfiguration config = (DefaultConfiguration) ConfigurationLoader
- .loadConfiguration(configLocation, new PropertiesExpander(System.getProperties()));
-
- // add the suppression file to the configuration
- DefaultConfiguration suppressions = new DefaultConfiguration("SuppressionFilter");
- suppressions.addAttribute("file", suppressionLocation);
- config.addChild(suppressions);
-
- this.config = config;
- } catch (CheckstyleException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public void execute(BuckTaskContext context) {
- List<String> input = context.input();
- if (input.size() < 3 || input.get(2).length() == 0) {
- return;
- }
- String project = input.get(0);
- String baseDir = input.get(1);
-
- // create a listener for output
- StringAuditor listener = new StringAuditor(context);
- listener.setProjectName(project);
- listener.setBaseDir(baseDir);
-
- // create Checker object and run it
- final Checker checker = new Checker();
- final ClassLoader moduleClassLoader = Checker.class.getClassLoader();
- checker.setModuleClassLoader(moduleClassLoader);
-
- try {
- checker.configure(config);
- checker.addListener(listener);
-
- // run Checker
- List<File> fileList = input.subList(2, input.size()).stream()
- .filter(s -> !s.contains("/:")) // Yes, fighting a hack with a hack.
- .map(File::new)
- .collect(Collectors.toList());
- int errorCounter = checker.process(fileList);
- if (errorCounter > 0) {
- context.output("CHECKSTYLE ERROR");
- }
-
- listener.await();
- } catch (CheckstyleException | InterruptedException e) {
- e.printStackTrace(); //dump exeception to stderr
- throw new RuntimeException(e);
- } finally {
- checker.destroy();
- }
-
- }
-
- static class StringAuditor implements AuditListener {
-
- private final BuckTaskContext context;
- private CountDownLatch finishedLatch = new CountDownLatch(1);
- private String baseDir = "";
- private String project = "";
-
- StringAuditor(BuckTaskContext context) {
- this.context = context;
- }
-
- public void setBaseDir(String base) {
- this.baseDir = base;
- }
-
- public void setProjectName(String projectName) {
- this.project = projectName;
- }
-
- public void await() throws InterruptedException {
- finishedLatch.await();
- }
-
- @Override
- public void auditStarted(AuditEvent evt) {
- }
-
- @Override
- public void auditFinished(AuditEvent evt) {
- finishedLatch.countDown();
- }
-
- @Override
- public void fileStarted(AuditEvent evt) {
- }
-
- @Override
- public void fileFinished(AuditEvent evt) {
- }
-
- @Override
- public void addError(AuditEvent evt) {
- switch (evt.getSeverityLevel()) {
- case ERROR:
- StringBuilder output = new StringBuilder();
- String fileName = evt.getFileName();
- if (!isNullOrEmpty(baseDir)) {
- int index = fileName.indexOf(baseDir);
- if (index >= 0) {
- fileName = fileName.substring(index + baseDir.length() + 1);
- if (!isNullOrEmpty(project)) {
- output.append(project).append(':');
- }
- }
- }
- output.append(fileName).append(':').append(evt.getLine());
- if (evt.getColumn() > 0) {
- output.append(':').append(evt.getColumn());
- }
- output.append(": ").append(evt.getMessage());
- context.output(output.toString());
- break;
- case IGNORE:
- case INFO:
- case WARNING:
- default:
- break;
- }
- }
-
- @Override
- public void addException(AuditEvent evt, Throwable throwable) {
- addError(evt);
- context.output(throwable.getMessage());
- }
- }
-
-}
diff --git a/tools/build/conf/src/main/java/org/onosproject/checkstyle/package-info.java b/tools/build/conf/src/main/java/org/onosproject/checkstyle/package-info.java
deleted file mode 100644
index 241a819..0000000
--- a/tools/build/conf/src/main/java/org/onosproject/checkstyle/package-info.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright 2018-present Open Networking Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**
- * checkstyle runner for BuckDaemon.
- */
-package org.onosproject.checkstyle;
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>
diff --git a/tools/build/jdk/BUILD b/tools/build/jdk/BUILD
index 59934fc..0055031 100644
--- a/tools/build/jdk/BUILD
+++ b/tools/build/jdk/BUILD
@@ -3,12 +3,13 @@
# :default_jdk are expected to be passed as arguments when invoking bazel build
# (see onos/.bazelrc)
+load("//tools/build/bazel:variables.bzl", "DEFAULT_JAVA_VERSION")
load("@bazel_tools//tools/jdk:default_java_toolchain.bzl", "default_java_toolchain")
default_java_toolchain(
name = "default_toolchain",
- source_version = "11",
- target_version = "11",
+ source_version = DEFAULT_JAVA_VERSION,
+ target_version = DEFAULT_JAVA_VERSION,
visibility = ["//visibility:public"],
)
diff --git a/tools/build/onos-change-version b/tools/build/onos-change-version
index f9ea36d..a0dad83 100755
--- a/tools/build/onos-change-version
+++ b/tools/build/onos-change-version
@@ -28,8 +28,8 @@
# Augment the version in archetypes tree.
mvn -q -B -f tools/package/archetypes/pom.xml versions:set -DnewVersion=$NEW_VERSION versions:commit
for atype in api bundle cli rest ui ui2 uitab uitopo; do
- pom="tools/package/archetypes/$atype/src/main/resources/archetype-resources/pom.xml"
- sed -i".VERBACK" -E "1,/<onos.version>/s/<onos.version>[^<]*</<onos.version>$NEW_VERSION</g" $pom
+ meta="tools/package/archetypes/$atype/src/main/resources/META-INF/maven/archetype-metadata.xml"
+ sed -i".VERBACK" -E "1,/<defaultValue>/s/<defaultValue>[^<]*</<defaultValue>$NEW_VERSION</g" $meta
done
sed -i".VERBACK" -E "s/-DarchetypeVersion=[^\"]*/-DarchetypeVersion=$NEW_VERSION/g" $ONOS_ROOT/tools/test/bin/onos-archetypes-test
diff --git a/tools/build/onos-publish-catalog b/tools/build/onos-publish-catalog
index cd2015b..595c74e 100755
--- a/tools/build/onos-publish-catalog
+++ b/tools/build/onos-publish-catalog
@@ -35,11 +35,15 @@
}
function jars {
- egrep -v '(\#|build/conf)' tools/build/publish-target-list
+ egrep -v '(\#)' tools/build/publish-target-list
}
function testJars {
- egrep -v '(\#|build/conf)' tools/build/publish-test-target-list
+ egrep -v '(\#)' tools/build/publish-test-target-list
+}
+
+function sources {
+ egrep -v '(\#|build/conf|dependencies)' tools/build/publish-target-list
}
echo "Cataloging jar files..."
@@ -54,9 +58,9 @@
[ $libsOnly = true ] && exit 0
echo "Cataloging source jars..."
-writeCatalog $(jars | sed 's/$/-sources/')
+writeCatalog $(sources | sed 's/$/-sources/')
echo "Cataloging javadoc jars..."
-writeCatalog $(jars | sed 's/$/-javadoc/')
+writeCatalog $(sources | sed 's/$/-javadoc/')
echo "Cataloging oar files..."
writeCatalog $(bazel query 'kind("_onos_oar rule", //...)')
diff --git a/tools/build/publish-target-list b/tools/build/publish-target-list
index 7d9a87b..bc769ee 100644
--- a/tools/build/publish-target-list
+++ b/tools/build/publish-target-list
@@ -44,6 +44,7 @@
//protocols/restconf/client/api:onos-protocols-restconf-client-api
//protocols/snmp/api:onos-protocols-snmp-api
//tools/build/conf:onos-build-conf
+ //tools/package/dependencies:onos-dependencies
//utils/junit:onlab-junit
//utils/misc:onlab-misc
//utils/osgi:onlab-osgi
diff --git a/tools/package/archetypes/api/src/main/resources/META-INF/maven/archetype-metadata.xml b/tools/package/archetypes/api/src/main/resources/META-INF/maven/archetype-metadata.xml
index e832eb7..4a0a850 100644
--- a/tools/package/archetypes/api/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/tools/package/archetypes/api/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -27,4 +27,9 @@
</includes>
</fileSet>
</fileSets>
+ <requiredProperties>
+ <requiredProperty key="onosVersion">
+ <defaultValue>2.2.1-SNAPSHOT</defaultValue>
+ </requiredProperty>
+ </requiredProperties>
</archetype-descriptor>
diff --git a/tools/package/archetypes/api/src/main/resources/archetype-resources/pom.xml b/tools/package/archetypes/api/src/main/resources/archetype-resources/pom.xml
index 24ceb2f..acded36 100644
--- a/tools/package/archetypes/api/src/main/resources/archetype-resources/pom.xml
+++ b/tools/package/archetypes/api/src/main/resources/archetype-resources/pom.xml
@@ -22,6 +22,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-dependencies</artifactId>
+ <version>${onosVersion}</version>
+ </parent>
+
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
@@ -30,37 +36,13 @@
<description>ONOS OSGi API bundle archetype</description>
<url>http://onosproject.org</url>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <onos.version>2.3.0-SNAPSHOT</onos.version>
- </properties>
-
<dependencies>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-api</artifactId>
<version>${onos.version}</version>
+ <scope>provided</scope>
</dependency>
</dependencies>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>3.3.0</version>
- <extensions>true</extensions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.7.0</version>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
</project>
diff --git a/tools/package/archetypes/api/src/test/resources/projects/basic/archetype.properties b/tools/package/archetypes/api/src/test/resources/projects/basic/archetype.properties
index 24316bf..7e7c139 100644
--- a/tools/package/archetypes/api/src/test/resources/projects/basic/archetype.properties
+++ b/tools/package/archetypes/api/src/test/resources/projects/basic/archetype.properties
@@ -19,3 +19,4 @@
version=0.1-SNAPSHOT
groupId=archetype.it
artifactId=basic
+onosVersion=1.0
diff --git a/tools/package/archetypes/bundle/src/main/resources/META-INF/maven/archetype-metadata.xml b/tools/package/archetypes/bundle/src/main/resources/META-INF/maven/archetype-metadata.xml
index 3461339..ee3f072 100644
--- a/tools/package/archetypes/bundle/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/tools/package/archetypes/bundle/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -33,4 +33,9 @@
</includes>
</fileSet>
</fileSets>
+ <requiredProperties>
+ <requiredProperty key="onosVersion">
+ <defaultValue>2.2.1-SNAPSHOT</defaultValue>
+ </requiredProperty>
+ </requiredProperties>
</archetype-descriptor>
diff --git a/tools/package/archetypes/bundle/src/main/resources/archetype-resources/pom.xml b/tools/package/archetypes/bundle/src/main/resources/archetype-resources/pom.xml
index 92d5269..08f248b 100644
--- a/tools/package/archetypes/bundle/src/main/resources/archetype-resources/pom.xml
+++ b/tools/package/archetypes/bundle/src/main/resources/archetype-resources/pom.xml
@@ -22,6 +22,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-dependencies</artifactId>
+ <version>${onosVersion}</version>
+ </parent>
+
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
@@ -31,8 +37,6 @@
<url>http://onosproject.org</url>
<properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <onos.version>2.3.0-SNAPSHOT</onos.version>
<!-- Uncomment to generate ONOS app from this module.
<onos.app.name>org.foo.app</onos.app.name>
<onos.app.title>Foo App</onos.app.title>
@@ -48,125 +52,37 @@
<groupId>org.onosproject</groupId>
<artifactId>onos-api</artifactId>
<version>${onos.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onlab-osgi</artifactId>
<version>${onos.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onlab-misc</artifactId>
<version>${onos.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.7.25</version>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>22.0</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>2.9.5</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-api</artifactId>
<version>${onos.version}</version>
<scope>test</scope>
<classifier>tests</classifier>
</dependency>
-
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.service.component</artifactId>
- <version>1.4.0</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.service.component.annotations</artifactId>
- <version>1.4.0</version>
- <scope>provided</scope>
- </dependency> </dependencies>
+ </dependencies>
<build>
<plugins>
<plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>3.5.0</version>
- <extensions>true</extensions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.8.0</version>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- <version>1.26.0</version>
- <configuration>
- <supportedProjectTypes>
- <supportedProjectType>bundle</supportedProjectType>
- <supportedProjectType>war</supportedProjectType>
- </supportedProjectTypes>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.onosproject</groupId>
<artifactId>onos-maven-plugin</artifactId>
- <version>2.1</version>
- <executions>
- <execution>
- <id>cfg</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>cfg</goal>
- </goals>
- </execution>
- <execution>
- <id>swagger</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>swagger</goal>
- </goals>
- </execution>
- <execution>
- <id>app</id>
- <phase>package</phase>
- <goals>
- <goal>app</goal>
- </goals>
- </execution>
- </executions>
</plugin>
</plugins>
</build>
diff --git a/tools/package/archetypes/bundle/src/test/resources/projects/basic/archetype.properties b/tools/package/archetypes/bundle/src/test/resources/projects/basic/archetype.properties
index 24316bf..7e7c139 100644
--- a/tools/package/archetypes/bundle/src/test/resources/projects/basic/archetype.properties
+++ b/tools/package/archetypes/bundle/src/test/resources/projects/basic/archetype.properties
@@ -19,3 +19,4 @@
version=0.1-SNAPSHOT
groupId=archetype.it
artifactId=basic
+onosVersion=1.0
diff --git a/tools/package/archetypes/cli/src/main/resources/META-INF/maven/archetype-metadata.xml b/tools/package/archetypes/cli/src/main/resources/META-INF/maven/archetype-metadata.xml
index c77ad49..a6619f2 100644
--- a/tools/package/archetypes/cli/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/tools/package/archetypes/cli/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -33,4 +33,9 @@
</includes>
</fileSet>
</fileSets>
+ <requiredProperties>
+ <requiredProperty key="onosVersion">
+ <defaultValue>2.2.1-SNAPSHOT</defaultValue>
+ </requiredProperty>
+ </requiredProperties>
</archetype-descriptor>
diff --git a/tools/package/archetypes/cli/src/main/resources/archetype-resources/pom.xml b/tools/package/archetypes/cli/src/main/resources/archetype-resources/pom.xml
index b5b3f4f..e98fdcd 100644
--- a/tools/package/archetypes/cli/src/main/resources/archetype-resources/pom.xml
+++ b/tools/package/archetypes/cli/src/main/resources/archetype-resources/pom.xml
@@ -22,6 +22,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-dependencies</artifactId>
+ <version>${onosVersion}</version>
+ </parent>
+
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
@@ -30,29 +36,19 @@
<description>ONOS OSGi bundle archetype</description>
<url>http://onosproject.org</url>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <onos.version>2.3.0-SNAPSHOT</onos.version>
- </properties>
-
<dependencies>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onos-api</artifactId>
<version>${onos.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onlab-osgi</artifactId>
<version>${onos.version}</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>test</scope>
+ <scope>provided</scope>
</dependency>
<dependency>
@@ -71,21 +67,8 @@
</dependency>
<dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>5.0.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.service.component.annotations</artifactId>
- <version>1.4.0</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.console</artifactId>
- <version>4.2.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
@@ -95,34 +78,12 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>3.5.0</version>
- <extensions>true</extensions>
<configuration>
<instructions>
<Karaf-Commands>${package}</Karaf-Commands>
</instructions>
</configuration>
</plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.8.0</version>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- <version>1.26.0</version>
- <configuration>
- <supportedProjectTypes>
- <supportedProjectType>bundle</supportedProjectType>
- <supportedProjectType>war</supportedProjectType>
- </supportedProjectTypes>
- </configuration>
- </plugin>
</plugins>
</build>
diff --git a/tools/package/archetypes/cli/src/test/resources/projects/basic/archetype.properties b/tools/package/archetypes/cli/src/test/resources/projects/basic/archetype.properties
index 24316bf..7e7c139 100644
--- a/tools/package/archetypes/cli/src/test/resources/projects/basic/archetype.properties
+++ b/tools/package/archetypes/cli/src/test/resources/projects/basic/archetype.properties
@@ -19,3 +19,4 @@
version=0.1-SNAPSHOT
groupId=archetype.it
artifactId=basic
+onosVersion=1.0
diff --git a/tools/package/archetypes/rest/src/main/resources/META-INF/maven/archetype-metadata.xml b/tools/package/archetypes/rest/src/main/resources/META-INF/maven/archetype-metadata.xml
index 62275f5..f6bfca2 100644
--- a/tools/package/archetypes/rest/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/tools/package/archetypes/rest/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -33,4 +33,9 @@
</includes>
</fileSet>
</fileSets>
+ <requiredProperties>
+ <requiredProperty key="onosVersion">
+ <defaultValue>2.2.1-SNAPSHOT</defaultValue>
+ </requiredProperty>
+ </requiredProperties>
</archetype-descriptor>
diff --git a/tools/package/archetypes/rest/src/main/resources/archetype-resources/pom.xml b/tools/package/archetypes/rest/src/main/resources/archetype-resources/pom.xml
index 071d4da..3abcc18 100644
--- a/tools/package/archetypes/rest/src/main/resources/archetype-resources/pom.xml
+++ b/tools/package/archetypes/rest/src/main/resources/archetype-resources/pom.xml
@@ -22,6 +22,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-dependencies</artifactId>
+ <version>${onosVersion}</version>
+ </parent>
+
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
@@ -31,9 +37,6 @@
<url>http://onosproject.org</url>
<properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <onos.version>2.3.0-SNAPSHOT</onos.version>
-
<web.context>/onos/${artifactId}</web.context>
<api.version>1.0.0</api.version>
<api.title>Sample app REST API</api.title>
@@ -48,19 +51,14 @@
<groupId>org.onosproject</groupId>
<artifactId>onos-api</artifactId>
<version>${onos.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onlab-osgi</artifactId>
<version>${onos.version}</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>test</scope>
+ <scope>provided</scope>
</dependency>
<dependency>
@@ -94,46 +92,30 @@
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
- <version>2.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
- <version>2.26</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
- <version>2.9.5</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-annotations</artifactId>
- <version>2.9.5</version>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.core</artifactId>
- <version>5.0.0</version>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
<scope>provided</scope>
</dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.service.component.annotations</artifactId>
- <version>1.4.0</version>
- <scope>provided</scope>
- </dependency>
+
<dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.console</artifactId>
- <version>4.2.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
@@ -143,8 +125,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
- <version>3.5.0</version>
- <extensions>true</extensions>
<configuration>
<instructions>
<_wab>src/main/webapp/</_wab>
@@ -152,9 +132,6 @@
WEB-INF/classes/apidoc/swagger.json=target/swagger.json,
{maven-resources}
</Include-Resource>
- <Bundle-SymbolicName>
- ${project.groupId}.${project.artifactId}
- </Bundle-SymbolicName>
<Import-Package>
*,org.glassfish.jersey.servlet
</Import-Package>
@@ -163,52 +140,8 @@
</configuration>
</plugin>
<plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.8.0</version>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- <version>1.26.0</version>
- <configuration>
- <supportedProjectTypes>
- <supportedProjectType>bundle</supportedProjectType>
- <supportedProjectType>war</supportedProjectType>
- </supportedProjectTypes>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.onosproject</groupId>
<artifactId>onos-maven-plugin</artifactId>
- <version>2.0</version>
- <executions>
- <execution>
- <id>cfg</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>cfg</goal>
- </goals>
- </execution>
- <execution>
- <id>swagger</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>swagger</goal>
- </goals>
- </execution>
- <execution>
- <id>app</id>
- <phase>package</phase>
- <goals>
- <goal>app</goal>
- </goals>
- </execution>
- </executions>
</plugin>
</plugins>
</build>
diff --git a/tools/package/archetypes/ui/src/main/resources/META-INF/maven/archetype-metadata.xml b/tools/package/archetypes/ui/src/main/resources/META-INF/maven/archetype-metadata.xml
index 5946d3f..8e61058 100644
--- a/tools/package/archetypes/ui/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/tools/package/archetypes/ui/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -35,4 +35,9 @@
</includes>
</fileSet>
</fileSets>
+ <requiredProperties>
+ <requiredProperty key="onosVersion">
+ <defaultValue>2.2.1-SNAPSHOT</defaultValue>
+ </requiredProperty>
+ </requiredProperties>
</archetype-descriptor>
diff --git a/tools/package/archetypes/ui/src/main/resources/archetype-resources/pom.xml b/tools/package/archetypes/ui/src/main/resources/archetype-resources/pom.xml
index 66ecfa4..3bb5fdd 100644
--- a/tools/package/archetypes/ui/src/main/resources/archetype-resources/pom.xml
+++ b/tools/package/archetypes/ui/src/main/resources/archetype-resources/pom.xml
@@ -22,6 +22,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-dependencies</artifactId>
+ <version>${onosVersion}</version>
+ </parent>
+
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
@@ -31,8 +37,6 @@
<url>http://onosproject.org</url>
<properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <onos.version>2.3.0-SNAPSHOT</onos.version>
<!-- Uncomment to generate ONOS app from this module.
<onos.app.name>org.foo.app</onos.app.name>
<onos.app.title>Foo App</onos.app.title>
@@ -48,19 +52,14 @@
<groupId>org.onosproject</groupId>
<artifactId>onos-api</artifactId>
<version>${onos.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onlab-osgi</artifactId>
<version>${onos.version}</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>test</scope>
+ <scope>provided</scope>
</dependency>
<dependency>
@@ -70,70 +69,13 @@
<scope>test</scope>
<classifier>tests</classifier>
</dependency>
-
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.service.component.annotations</artifactId>
- <version>1.4.0</version>
- <scope>provided</scope>
- </dependency>
</dependencies>
<build>
<plugins>
<plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>3.5.0</version>
- <extensions>true</extensions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.8.0</version>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- <version>1.26.0</version>
- <configuration>
- <supportedProjectTypes>
- <supportedProjectType>bundle</supportedProjectType>
- <supportedProjectType>war</supportedProjectType>
- </supportedProjectTypes>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.onosproject</groupId>
<artifactId>onos-maven-plugin</artifactId>
- <version>2.0</version>
- <executions>
- <execution>
- <id>cfg</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>cfg</goal>
- </goals>
- </execution>
- <execution>
- <id>swagger</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>swagger</goal>
- </goals>
- </execution>
- <execution>
- <id>app</id>
- <phase>package</phase>
- <goals>
- <goal>app</goal>
- </goals>
- </execution>
- </executions>
</plugin>
</plugins>
</build>
diff --git a/tools/package/archetypes/ui/src/test/resources/projects/basic/archetype.properties b/tools/package/archetypes/ui/src/test/resources/projects/basic/archetype.properties
index 24316bf..7e7c139 100644
--- a/tools/package/archetypes/ui/src/test/resources/projects/basic/archetype.properties
+++ b/tools/package/archetypes/ui/src/test/resources/projects/basic/archetype.properties
@@ -19,3 +19,4 @@
version=0.1-SNAPSHOT
groupId=archetype.it
artifactId=basic
+onosVersion=1.0
diff --git a/tools/package/archetypes/ui2/src/main/resources/META-INF/maven/archetype-metadata.xml b/tools/package/archetypes/ui2/src/main/resources/META-INF/maven/archetype-metadata.xml
index 1d24909..92f81d8 100644
--- a/tools/package/archetypes/ui2/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/tools/package/archetypes/ui2/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -61,4 +61,9 @@
<include>ng-test.sh</include>
</fileSet>
</fileSets>
+ <requiredProperties>
+ <requiredProperty key="onosVersion">
+ <defaultValue>2.2.1-SNAPSHOT</defaultValue>
+ </requiredProperty>
+ </requiredProperties>
</archetype-descriptor>
diff --git a/tools/package/archetypes/ui2/src/main/resources/archetype-resources/app/pom.xml b/tools/package/archetypes/ui2/src/main/resources/archetype-resources/app/pom.xml
index 4a7c9fd..18d70f3 100644
--- a/tools/package/archetypes/ui2/src/main/resources/archetype-resources/app/pom.xml
+++ b/tools/package/archetypes/ui2/src/main/resources/archetype-resources/app/pom.xml
@@ -46,19 +46,14 @@
<groupId>org.onosproject</groupId>
<artifactId>onos-api</artifactId>
<version>${onos.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onlab-osgi</artifactId>
<version>${onos.version}</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>test</scope>
+ <scope>provided</scope>
</dependency>
<dependency>
@@ -68,70 +63,13 @@
<scope>test</scope>
<classifier>tests</classifier>
</dependency>
-
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.service.component.annotations</artifactId>
- <version>1.4.0</version>
- <scope>provided</scope>
- </dependency>
</dependencies>
<build>
<plugins>
<plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>3.5.0</version>
- <extensions>true</extensions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.8.0</version>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- <version>1.26.0</version>
- <configuration>
- <supportedProjectTypes>
- <supportedProjectType>bundle</supportedProjectType>
- <supportedProjectType>war</supportedProjectType>
- </supportedProjectTypes>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.onosproject</groupId>
<artifactId>onos-maven-plugin</artifactId>
- <version>2.0</version>
- <executions>
- <execution>
- <id>cfg</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>cfg</goal>
- </goals>
- </execution>
- <execution>
- <id>swagger</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>swagger</goal>
- </goals>
- </execution>
- <execution>
- <id>app</id>
- <phase>package</phase>
- <goals>
- <goal>app</goal>
- </goals>
- </execution>
- </executions>
</plugin>
</plugins>
</build>
diff --git a/tools/package/archetypes/ui2/src/main/resources/archetype-resources/pom.xml b/tools/package/archetypes/ui2/src/main/resources/archetype-resources/pom.xml
index f540dae..05da40c 100644
--- a/tools/package/archetypes/ui2/src/main/resources/archetype-resources/pom.xml
+++ b/tools/package/archetypes/ui2/src/main/resources/archetype-resources/pom.xml
@@ -29,6 +29,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-dependencies</artifactId>
+ <version>${onosVersion}</version>
+ </parent>
+
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
@@ -37,11 +43,6 @@
<description>ONOS OSGi GUI2 Custom-View bundle archetype</description>
<url>http://onosproject.org</url>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <onos.version>2.3.0-SNAPSHOT</onos.version>
- </properties>
-
<modules>
<module>app</module>
<module>web/${artifactId}-gui</module>
diff --git a/tools/package/archetypes/ui2/src/test/resources/projects/basic/archetype.properties b/tools/package/archetypes/ui2/src/test/resources/projects/basic/archetype.properties
index 24316bf..7e7c139 100644
--- a/tools/package/archetypes/ui2/src/test/resources/projects/basic/archetype.properties
+++ b/tools/package/archetypes/ui2/src/test/resources/projects/basic/archetype.properties
@@ -19,3 +19,4 @@
version=0.1-SNAPSHOT
groupId=archetype.it
artifactId=basic
+onosVersion=1.0
diff --git a/tools/package/archetypes/uitab/src/main/resources/META-INF/maven/archetype-metadata.xml b/tools/package/archetypes/uitab/src/main/resources/META-INF/maven/archetype-metadata.xml
index 4b4b522..935ea83 100644
--- a/tools/package/archetypes/uitab/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/tools/package/archetypes/uitab/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -36,4 +36,9 @@
</includes>
</fileSet>
</fileSets>
+ <requiredProperties>
+ <requiredProperty key="onosVersion">
+ <defaultValue>2.2.1-SNAPSHOT</defaultValue>
+ </requiredProperty>
+ </requiredProperties>
</archetype-descriptor>
diff --git a/tools/package/archetypes/uitab/src/main/resources/archetype-resources/pom.xml b/tools/package/archetypes/uitab/src/main/resources/archetype-resources/pom.xml
index 638a41c..7775946 100644
--- a/tools/package/archetypes/uitab/src/main/resources/archetype-resources/pom.xml
+++ b/tools/package/archetypes/uitab/src/main/resources/archetype-resources/pom.xml
@@ -23,6 +23,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-dependencies</artifactId>
+ <version>${onosVersion}</version>
+ </parent>
+
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
@@ -32,8 +38,6 @@
<url>http://onosproject.org</url>
<properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <onos.version>2.3.0-SNAPSHOT</onos.version>
<!-- Uncomment to generate ONOS app from this module.
<onos.app.name>org.foo.app</onos.app.name>
<onos.app.title>Foo App</onos.app.title>
@@ -49,19 +53,14 @@
<groupId>org.onosproject</groupId>
<artifactId>onos-api</artifactId>
<version>${onos.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onlab-osgi</artifactId>
<version>${onos.version}</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>test</scope>
+ <scope>provided</scope>
</dependency>
<dependency>
@@ -71,70 +70,13 @@
<scope>test</scope>
<classifier>tests</classifier>
</dependency>
-
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.service.component.annotations</artifactId>
- <version>1.4.0</version>
- <scope>provided</scope>
- </dependency>
</dependencies>
<build>
<plugins>
<plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>3.5.0</version>
- <extensions>true</extensions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.8.0</version>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- <version>1.26.0</version>
- <configuration>
- <supportedProjectTypes>
- <supportedProjectType>bundle</supportedProjectType>
- <supportedProjectType>war</supportedProjectType>
- </supportedProjectTypes>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.onosproject</groupId>
<artifactId>onos-maven-plugin</artifactId>
- <version>2.0</version>
- <executions>
- <execution>
- <id>cfg</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>cfg</goal>
- </goals>
- </execution>
- <execution>
- <id>swagger</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>swagger</goal>
- </goals>
- </execution>
- <execution>
- <id>app</id>
- <phase>package</phase>
- <goals>
- <goal>app</goal>
- </goals>
- </execution>
- </executions>
</plugin>
</plugins>
</build>
diff --git a/tools/package/archetypes/uitab/src/test/resources/projects/basic/archetype.properties b/tools/package/archetypes/uitab/src/test/resources/projects/basic/archetype.properties
index 24316bf..7e7c139 100644
--- a/tools/package/archetypes/uitab/src/test/resources/projects/basic/archetype.properties
+++ b/tools/package/archetypes/uitab/src/test/resources/projects/basic/archetype.properties
@@ -19,3 +19,4 @@
version=0.1-SNAPSHOT
groupId=archetype.it
artifactId=basic
+onosVersion=1.0
diff --git a/tools/package/archetypes/uitopo/src/main/resources/META-INF/maven/archetype-metadata.xml b/tools/package/archetypes/uitopo/src/main/resources/META-INF/maven/archetype-metadata.xml
index 01ec6f2..20cb7c4 100644
--- a/tools/package/archetypes/uitopo/src/main/resources/META-INF/maven/archetype-metadata.xml
+++ b/tools/package/archetypes/uitopo/src/main/resources/META-INF/maven/archetype-metadata.xml
@@ -36,4 +36,9 @@
</includes>
</fileSet>
</fileSets>
+ <requiredProperties>
+ <requiredProperty key="onosVersion">
+ <defaultValue>2.2.1-SNAPSHOT</defaultValue>
+ </requiredProperty>
+ </requiredProperties>
</archetype-descriptor>
diff --git a/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/pom.xml b/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/pom.xml
index dcbda09..412db9e 100644
--- a/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/pom.xml
+++ b/tools/package/archetypes/uitopo/src/main/resources/archetype-resources/pom.xml
@@ -23,6 +23,12 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-dependencies</artifactId>
+ <version>${onosVersion}</version>
+ </parent>
+
<groupId>${groupId}</groupId>
<artifactId>${artifactId}</artifactId>
<version>${version}</version>
@@ -32,8 +38,6 @@
<url>http://onosproject.org</url>
<properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- <onos.version>2.3.0-SNAPSHOT</onos.version>
<!-- Uncomment to generate ONOS app from this module.
<onos.app.name>org.foo.app</onos.app.name>
<onos.app.title>Foo App</onos.app.title>
@@ -49,19 +53,14 @@
<groupId>org.onosproject</groupId>
<artifactId>onos-api</artifactId>
<version>${onos.version}</version>
+ <scope>provided</scope>
</dependency>
<dependency>
<groupId>org.onosproject</groupId>
<artifactId>onlab-osgi</artifactId>
<version>${onos.version}</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.12</version>
- <scope>test</scope>
+ <scope>provided</scope>
</dependency>
<dependency>
@@ -71,70 +70,13 @@
<scope>test</scope>
<classifier>tests</classifier>
</dependency>
-
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.service.component.annotations</artifactId>
- <version>1.4.0</version>
- <scope>provided</scope>
- </dependency>
</dependencies>
<build>
<plugins>
<plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <version>3.5.0</version>
- <extensions>true</extensions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>3.8.0</version>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-scr-plugin</artifactId>
- <version>1.26.0</version>
- <configuration>
- <supportedProjectTypes>
- <supportedProjectType>bundle</supportedProjectType>
- <supportedProjectType>war</supportedProjectType>
- </supportedProjectTypes>
- </configuration>
- </plugin>
- <plugin>
<groupId>org.onosproject</groupId>
<artifactId>onos-maven-plugin</artifactId>
- <version>2.0</version>
- <executions>
- <execution>
- <id>cfg</id>
- <phase>generate-resources</phase>
- <goals>
- <goal>cfg</goal>
- </goals>
- </execution>
- <execution>
- <id>swagger</id>
- <phase>generate-sources</phase>
- <goals>
- <goal>swagger</goal>
- </goals>
- </execution>
- <execution>
- <id>app</id>
- <phase>package</phase>
- <goals>
- <goal>app</goal>
- </goals>
- </execution>
- </executions>
</plugin>
</plugins>
</build>
diff --git a/tools/package/archetypes/uitopo/src/test/resources/projects/basic/archetype.properties b/tools/package/archetypes/uitopo/src/test/resources/projects/basic/archetype.properties
index 24316bf..7e7c139 100644
--- a/tools/package/archetypes/uitopo/src/test/resources/projects/basic/archetype.properties
+++ b/tools/package/archetypes/uitopo/src/test/resources/projects/basic/archetype.properties
@@ -19,3 +19,4 @@
version=0.1-SNAPSHOT
groupId=archetype.it
artifactId=basic
+onosVersion=1.0
diff --git a/tools/package/dependencies/BUILD b/tools/package/dependencies/BUILD
new file mode 100644
index 0000000..63adf9c
--- /dev/null
+++ b/tools/package/dependencies/BUILD
@@ -0,0 +1,69 @@
+load("//tools/build/bazel:pom_file.bzl", "dependencies_pom")
+load(
+ "//tools/build/bazel:variables.bzl",
+ "DEFAULT_JAVA_VERSION",
+ "ONOS_ARTIFACT_BASE",
+ "ONOS_GROUP_ID",
+ "ONOS_VERSION",
+)
+load(
+ "//tools/build/bazel:generate_workspace.bzl",
+ "CLI",
+ "CORE_DEPS",
+ "JACKSON",
+ "JAXB",
+ "KRYO",
+ "REST",
+ "TEST",
+)
+
+# Listed in the <dependencyManagement> section of the generated pom
+DEPS = [
+ d
+ for d in CORE_DEPS + JAXB + JACKSON + KRYO +
+ CLI + REST + TEST
+ # Keep only third-party (external) ones.
+ if d.startswith("@")
+] + [
+ "@org_apache_karaf_shell_console//jar",
+ "@org_osgi_cmpn//jar",
+ "@jersey_container_servlet//jar",
+]
+
+# Listed in the <dependencies> section with scope 'provided'
+DEPS_PROVIDED = [
+ "@com_google_guava_guava//jar",
+ "@slf4j_api//jar",
+ "@osgi_core//jar",
+ "@org_osgi_cmpn//jar",
+ "@org_osgi_util_promise//jar",
+ "@org_osgi_service_component//jar",
+ "@org_osgi_service_component_annotations//jar",
+ "@org_osgi_service_metatype_annotations//jar",
+]
+
+# Listed in the <dependencies> section with scope 'test'.
+DEPS_TEST = [d for d in TEST if d.startswith("@")]
+
+VARS = [
+ "ONOS_VERSION=" + ONOS_VERSION,
+ "ONOS_GROUP_ID=" + ONOS_GROUP_ID,
+ "ONOS_ARTIFACT_BASE=" + ONOS_ARTIFACT_BASE,
+ "JAVA_VERSION=" + DEFAULT_JAVA_VERSION,
+]
+
+dependencies_pom(
+ name = "onos-dependencies-pom",
+ deps_provided = DEPS_PROVIDED,
+ deps_test = DEPS_TEST,
+ pom_template = "template.pom",
+ vars = VARS,
+ deps = DEPS,
+)
+
+# An empty jar, so we can re-use onos-publish logic.
+java_library(
+ name = "onos-dependencies",
+ resources = ["empty.txt"],
+ visibility = ["//visibility:public"],
+)
diff --git a/tools/package/dependencies/empty.txt b/tools/package/dependencies/empty.txt
new file mode 100644
index 0000000..4c5974d7
--- /dev/null
+++ b/tools/package/dependencies/empty.txt
@@ -0,0 +1 @@
+This jar is intentionally left empty
\ No newline at end of file
diff --git a/tools/package/dependencies/template.pom b/tools/package/dependencies/template.pom
new file mode 100644
index 0000000..b886639
--- /dev/null
+++ b/tools/package/dependencies/template.pom
@@ -0,0 +1,386 @@
+<!--
+ ~ Copyright 2019-present Open Networking Foundation
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-base</artifactId>
+ <version>1</version>
+ </parent>
+
+ <artifactId><!-- ONOS_ARTIFACT_BASE -->dependencies</artifactId>
+ <groupId><!-- ONOS_GROUP_ID --></groupId>
+ <packaging>pom</packaging>
+ <version><!-- ONOS_VERSION --></version>
+ <name>${project.artifactId}</name>
+ <description>ONOS shared dependencies for third-party apps</description>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <karaf.version>4.2.6</karaf.version>
+ <maven.version.min>3.3.9</maven.version.min>
+ <java.version.min><!-- JAVA_VERSION --></java.version.min>
+ <onos.version><!-- ONOS_VERSION --></onos.version>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <!-- DEPS_MGMT -->
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <!-- DEPS -->
+ </dependencies>
+
+ <build>
+
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.8.0</version>
+ <configuration>
+ <release>11</release>
+ </configuration>
+ <inherited>true</inherited>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <version>3.0.0-M2</version>
+ <executions>
+ <execution>
+ <id>enforce-maven</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requireMavenVersion>
+
+ <version>[${maven.version.min},)</version>
+ </requireMavenVersion>
+ </rules>
+ </configuration>
+ </execution>
+ <execution>
+ <id>enforce-java</id>
+ <goals>
+ <goal>enforce</goal>
+ </goals>
+ <configuration>
+ <rules>
+ <requireJavaVersion>
+ <version>[${java.version.min},)</version>
+ </requireJavaVersion>
+ </rules>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>3.1.0</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>3.0.0-M1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <version>3.0.0-M1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-site-plugin</artifactId>
+ <version>3.8.2</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-project-info-reports-plugin</artifactId>
+ <version>3.0.0</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>3.0.0-M3</version>
+ <configuration>
+ <redirectTestOutputToFile>
+ true
+ </redirectTestOutputToFile>
+ <printSummary>
+ true
+ </printSummary>
+ <excludedGroups>
+ org.onlab.junit.IntegrationTest
+ </excludedGroups>
+ <rerunFailingTestsCount>
+ 1
+ </rerunFailingTestsCount>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>3.1.1</version>
+ <configuration>
+ <tags>
+ <tag>
+ <name>onos.rsModel</name>
+ <placement>m</placement>
+ <head>Json model for REST api:</head>
+ </tag>
+ </tags>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>3.2.0</version>
+ <configuration>
+ <skipIfEmpty>true</skipIfEmpty>
+ </configuration>
+ <executions>
+ <execution>
+ <id>default</id>
+ <goals>
+ <goal>test-jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <version>3.0.0</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-build-conf</artifactId>
+ <version>${onos.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.puppycrawl.tools</groupId>
+ <artifactId>checkstyle</artifactId>
+ <version>8.10</version>
+ </dependency>
+ </dependencies>
+ <configuration>
+ <configLocation>
+ onos/checkstyle-mvn.xml
+ </configLocation>
+ <suppressionsLocation>
+ onos/suppressions.xml
+ </suppressionsLocation>
+ <headerLocation>
+ onos/onos-java.header
+ </headerLocation>
+ <failsOnError>false</failsOnError>
+ <logViolationsToConsole>true</logViolationsToConsole>
+ <includeTestSourceDirectory>true</includeTestSourceDirectory>
+ <includeResources>false</includeResources>
+ </configuration>
+ <executions>
+ <execution>
+ <id>validate-checkstyle</id>
+ <phase>verify</phase>
+ <goals>
+ <goal>check</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ <version>3.12.0</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-build-conf</artifactId>
+ <version>${onos.version}</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <id>validate-pmd</id>
+ <phase>verify</phase>
+ <goals>
+ <!-- Uncomment this goal to make the build fail on pmd errors -->
+ <!-- <goal>check</goal> -->
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <rulesets>
+ <ruleset>onos/pmd.xml</ruleset>
+ </rulesets>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ <version>0.8.5</version>
+ <executions>
+ <execution>
+ <id>default-prepare-agent</id>
+ <goals>
+ <goal>prepare-agent</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>default-report</id>
+ <phase>prepare-package</phase>
+ <goals>
+ <goal>report</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-resources-plugin</artifactId>
+ <version>3.1.0</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <version>4.1.0</version>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>
+ ${project.groupId}.${project.artifactId}
+ </Bundle-SymbolicName>
+ <_dsannotations-options>inherit</_dsannotations-options>
+ </instructions>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>3.1.0</version>
+ <executions>
+ <execution>
+ <id>attach-sources</id>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-shade-plugin</artifactId>
+ <version>3.1.1</version>
+ </plugin>
+ <plugin>
+ <groupId>com.github.spotbugs</groupId>
+ <artifactId>spotbugs-maven-plugin</artifactId>
+ <version>3.1.12</version>
+ <configuration>
+ <effort>Max</effort>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-maven-plugin</artifactId>
+ <!-- This version needs to be updated manually when changes
+ are made to onos-maven-plugin -->
+ <version>2.2</version>
+ <executions>
+ <execution>
+ <id>cfg</id>
+ <phase>generate-resources</phase>
+ <goals>
+ <goal>cfg</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>swagger</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>swagger</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>app</id>
+ <phase>package</phase>
+ <goals>
+ <goal>app</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.karaf.tooling</groupId>
+ <artifactId>karaf-maven-plugin</artifactId>
+ <version>${karaf.version}</version>
+ <extensions>true</extensions>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-pmd-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.jacoco</groupId>
+ <artifactId>jacoco-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>com.github.spotbugs</groupId>
+ <artifactId>spotbugs-maven-plugin</artifactId>
+ </plugin>
+ </plugins>
+ </reporting>
+
+</project>