Add example for creating apex policy in Tosca format
[policy/apex-pdp.git] / examples / examples-onap-vcpe / pom.xml
1 <!--
2   ============LICENSE_START=======================================================
3    Copyright (C) 2018 Ericsson. All rights reserved.
4    Copyright (C) 2019 Nordix Foundation.
5   ================================================================================
6   Licensed under the Apache License, Version 2.0 (the "License");
7   you may not use this file except in compliance with the License.
8   You may obtain a copy of the License at
9
10        http://www.apache.org/licenses/LICENSE-2.0
11
12   Unless required by applicable law or agreed to in writing, software
13   distributed under the License is distributed on an "AS IS" BASIS,
14   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   See the License for the specific language governing permissions and
16   limitations under the License.
17
18   SPDX-License-Identifier: Apache-2.0
19   ============LICENSE_END=========================================================
20 -->
21 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
23     <modelVersion>4.0.0</modelVersion>
24     <parent>
25         <groupId>org.onap.policy.apex-pdp.examples</groupId>
26         <artifactId>examples</artifactId>
27         <version>2.3.0-SNAPSHOT</version>
28     </parent>
29
30     <artifactId>examples-onap-vcpe</artifactId>
31     <name>${project.artifactId}</name>
32     <description>Specific code for the APEX ONAP vCPE Example</description>
33
34     <properties>
35         <policymodel.name>ONAPvCPEPolicyModel</policymodel.name>
36         <toscapolicy.name>ONAPvCPEToscaPolicy</toscapolicy.name>
37         <apex-domains-onap-vcpe-dir>${project.basedir}/src</apex-domains-onap-vcpe-dir>
38     </properties>
39
40     <dependencies>
41         <dependency>
42             <groupId>org.onap.policy.apex-pdp.auth</groupId>
43             <artifactId>cli-editor</artifactId>
44             <version>${project.version}</version>
45         </dependency>
46         <dependency>
47             <groupId>org.onap.policy.apex-pdp.services</groupId>
48             <artifactId>services-engine</artifactId>
49             <version>${project.version}</version>
50             <scope>test</scope>
51         </dependency>
52         <dependency>
53             <groupId>org.glassfish.jersey.containers</groupId>
54             <artifactId>jersey-container-grizzly2-http</artifactId>
55             <version>${version.jersey}</version>
56             <scope>test</scope>
57         </dependency>
58         <dependency>
59             <groupId>org.glassfish.jersey.inject</groupId>
60             <artifactId>jersey-hk2</artifactId>
61             <version>${version.jersey}</version>
62             <scope>test</scope>
63         </dependency>
64         <dependency>
65             <groupId>org.onap.policy.apex-pdp.plugins.plugins-context.plugins-context-schema</groupId>
66             <artifactId>plugins-context-schema-avro</artifactId>
67             <version>${project.version}</version>
68         </dependency>
69         <dependency>
70             <groupId>org.onap.policy.apex-pdp.plugins.plugins-executor</groupId>
71             <artifactId>plugins-executor-javascript</artifactId>
72             <version>${project.version}</version>
73         </dependency>
74         <dependency>
75             <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId>
76             <artifactId>plugins-event-carrier-restrequestor</artifactId>
77             <version>${project.version}</version>
78         </dependency>
79         <dependency>
80             <groupId>org.onap.policy.apex-pdp.plugins.plugins-event.plugins-event-carrier</groupId>
81             <artifactId>plugins-event-carrier-restclient</artifactId>
82             <version>${project.version}</version>
83         </dependency>
84         <dependency>
85             <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
86             <artifactId>aai</artifactId>
87             <version>${version.policy.models}</version>
88         </dependency>
89         <dependency>
90             <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
91             <artifactId>appclcm</artifactId>
92             <version>${version.policy.models}</version>
93         </dependency>
94         <dependency>
95             <groupId>org.onap.policy.models.policy-models-interactions.model-impl</groupId>
96             <artifactId>events</artifactId>
97             <version>${version.policy.models}</version>
98         </dependency>
99     </dependencies>
100
101     <build>
102         <plugins>
103             <!-- Generate the APEX Policy JSON from the APEX CLI command -->
104             <plugin>
105                 <groupId>org.codehaus.mojo</groupId>
106                 <artifactId>exec-maven-plugin</artifactId>
107                 <executions>
108                     <execution>
109                         <id>generate-policy</id>
110                         <phase>compile</phase>
111                         <goals>
112                             <goal>java</goal>
113                         </goals>
114                         <configuration>
115                             <mainClass>org.onap.policy.apex.auth.clieditor.ApexCommandLineEditorMain</mainClass>
116                             <classpathScope>compile</classpathScope>
117                             <arguments>
118                                 <argument>--command-file=${project.basedir}/src/main/resources/policy/${policymodel.name}.apex</argument>
119                                 <argument>--output-model-file=${project.build.directory}/classes/${policymodel.name}.json</argument>
120                                 <argument>--log-file=${project.build.directory}/${policymodel.name}_policygeneration.log</argument>
121                                 <argument>--working-dir=${project.basedir}</argument>
122                             </arguments>
123                         </configuration>
124                     </execution>
125                 </executions>
126             </plugin>
127             <!-- Generate the APEX ToscaPolicy JSON file-->
128             <plugin>
129                 <groupId>org.codehaus.mojo</groupId>
130                 <artifactId>exec-maven-plugin</artifactId>
131                 <executions>
132                     <execution>
133                         <id>generate-tosca-policy</id>
134                         <phase>compile</phase>
135                         <goals>
136                             <goal>java</goal>
137                         </goals>
138                         <configuration>
139                             <mainClass>org.onap.policy.apex.auth.clieditor.tosca.ApexCliToscaEditorMain</mainClass>
140                             <classpathScope>compile</classpathScope>
141                             <arguments>
142                                 <argument>--command-file=${project.basedir}/src/main/resources/policy/${policymodel.name}.apex</argument>
143                                 <argument>--output-tosca-file=${project.build.directory}/classes/${toscapolicy.name}.json</argument>
144                                 <argument>--log-file=${project.build.directory}/${policymodel.name}_policygeneration.log</argument>
145                                 <argument>--apex-config-file=${project.basedir}/src/main/resources/examples/config/ONAPvCPE/ApexConfig.json</argument>
146                                 <argument>--tosca-template-file=${project.basedir}/src/main/resources/tosca/ToscaTemplate.json</argument>
147                             </arguments>
148                         </configuration>
149                     </execution>
150                 </executions>
151             </plugin>
152         </plugins>
153     </build>
154
155     <profiles>
156         <profile>
157             <id>apexSite</id>
158             <activation>
159                 <property>
160                     <name>apexSite</name>
161                 </property>
162             </activation>
163             <properties>
164                 <adsite-examples-onap-vcpe-dir>${project.basedir}/src</adsite-examples-onap-vcpe-dir>
165             </properties>
166             <distributionManagement>
167                 <site>
168                     <id>${project.artifactId}-site</id>
169                     <url>${apex.adsite.prefix}/modules/${project.parent.artifactId}/${project.artifactId}/</url>
170                 </site>
171             </distributionManagement>
172         </profile>
173     </profiles>
174 </project>