Fixing onos-maven-plugin and revving it to 2.0-SNAPSHOT.
Change-Id: Ib48cf10aec56f56fb05b307255d8968b5ceba1cf
diff --git a/tools/package/maven-plugin/pom.xml b/tools/package/maven-plugin/pom.xml
new file mode 100644
index 0000000..31d5160
--- /dev/null
+++ b/tools/package/maven-plugin/pom.xml
@@ -0,0 +1,134 @@
+<!--
+ ~ Copyright 2015-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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-base</artifactId>
+ <version>1</version>
+ <relativePath>../../build/pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.onosproject</groupId>
+ <artifactId>onos-maven-plugin</artifactId>
+ <version>2.0-SNAPSHOT</version>
+ <packaging>maven-plugin</packaging>
+
+ <description>Maven plugin for packaging ONOS applications or generating
+ component configuration resources
+ </description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-plugin-api</artifactId>
+ <version>3.3.9</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.maven</groupId>
+ <artifactId>maven-project</artifactId>
+ <version>2.2.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.thoughtworks.qdox</groupId>
+ <artifactId>qdox</artifactId>
+ <version>2.0-M3</version>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
+ <version>20.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>3.2.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-configuration</groupId>
+ <artifactId>commons-configuration</artifactId>
+ <version>1.10</version>
+ </dependency>
+
+ <!-- dependencies to annotations -->
+ <dependency>
+ <groupId>org.apache.maven.plugin-tools</groupId>
+ <artifactId>maven-plugin-annotations</artifactId>
+ <version>3.4</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-databind</artifactId>
+ <version>2.9.5</version>
+ </dependency>
+ <dependency>
+ <groupId>com.fasterxml.jackson.core</groupId>
+ <artifactId>jackson-annotations</artifactId>
+ <version>2.9.5</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>2.6</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.code.gson</groupId>
+ <artifactId>gson</artifactId>
+ <version>2.7</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <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.maven.plugins</groupId>
+ <artifactId>maven-plugin-plugin</artifactId>
+ <version>3.6.0</version>
+ <executions>
+ <execution>
+ <id>default-descriptor</id>
+ <phase>process-classes</phase>
+ </execution>
+ <!-- if you want to generate help goal -->
+ <execution>
+ <id>help-goal</id>
+ <goals>
+ <goal>helpmojo</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/tools/package/maven-plugin/src/main/resources/org/onosproject/maven/registrator.javat b/tools/package/maven-plugin/src/main/resources/org/onosproject/maven/registrator.javat
index 6596450..b212129 100644
--- a/tools/package/maven-plugin/src/main/resources/org/onosproject/maven/registrator.javat
+++ b/tools/package/maven-plugin/src/main/resources/org/onosproject/maven/registrator.javat
@@ -14,19 +14,37 @@
* limitations under the License.
*
* Auto-generated by OnosSwaggerMojo.
- *
*/
package ${api.package};
-import org.apache.felix.scr.annotations.Component;
-import org.onosproject.rest.AbstractApiDocRegistrator;
+import org.osgi.service.component.annotations.Activate;
+import org.osgi.service.component.annotations.Component;
+import org.osgi.service.component.annotations.Deactivate;
+import org.osgi.service.component.annotations.Reference;
+import org.osgi.service.component.annotations.ReferenceCardinality;
import org.onosproject.rest.ApiDocProvider;
+import org.onosproject.rest.ApiDocService;
@Component(immediate = true)
-public class ApiDocRegistrator extends AbstractApiDocRegistrator {
+public class ApiDocRegistrator {
+
+ protected final ApiDocProvider provider;
+
+ @Reference(cardinality = ReferenceCardinality.MANDATORY)
+ protected ApiDocService service;
+
public ApiDocRegistrator() {
- super(new ApiDocProvider("${web.context}",
- "${api.title}",
- ApiDocRegistrator.class.getClassLoader()));
+ provider = new ApiDocProvider("${web.context}", "${api.title}",
+ getClass().getClassLoader());
+ }
+
+ @Activate
+ protected void activate() {
+ service.register(provider);
+ }
+
+ @Deactivate
+ protected void deactivate() {
+ service.unregister(provider);
}
}