Add distributionManagement
[cps.git] / cps-parent / pom.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <project xmlns="http://maven.apache.org/POM/4.0.0"
3          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5     <parent>
6         <groupId>org.onap.oparent</groupId>
7         <artifactId>oparent</artifactId>
8         <version>3.1.0</version>
9         <relativePath/>
10     </parent>
11     <modelVersion>4.0.0</modelVersion>
12
13     <groupId>org.onap.cps</groupId>
14     <artifactId>cps-parent</artifactId>
15     <version>0.0.1-SNAPSHOT</version>
16     <packaging>pom</packaging>
17
18     <properties>
19         <app>org.onap.cps.Application</app>
20         <base.image>openjdk:11-jre-slim</base.image>
21         <java.version>11</java.version>
22         <jib-maven-plugin.version>2.6.0</jib-maven-plugin.version>
23         <nexusproxy>https://nexus.onap.org</nexusproxy>
24         <onap.nexus.url>https://nexus.onap.org</onap.nexus.url>
25         <oparent.version>3.1.0</oparent.version>
26         <releaseNexusPath>/content/repositories/releases/</releaseNexusPath>
27         <repository.name>nexus3.onap.org:10001/onap/cps-service</repository.name>
28         <spring-boot-maven-plugin.version>2.3.3.RELEASE</spring-boot-maven-plugin.version>
29         <swagger-codegen-maven-plugin.version>3.0.18</swagger-codegen-maven-plugin.version>
30         <snapshotNexusPath>/content/repositories/snapshots/</snapshotNexusPath>
31         <stagingNexusPath>/content/repositories/staging/</stagingNexusPath>
32         <tag.version>${project.version}</tag.version>
33     </properties>
34
35     <distributionManagement>
36         <repository>
37             <id>ecomp-releases</id>
38             <name>ECOMP Release Repository</name>
39             <url>${nexusproxy}${releaseNexusPath}</url>
40         </repository>
41         <snapshotRepository>
42             <id>ecomp-snapshots</id>
43             <name>ECOMP Snapshot Repository</name>
44             <url>${nexusproxy}${snapshotNexusPath}</url>
45         </snapshotRepository>
46     </distributionManagement>
47
48     <profiles>
49         <profile>
50             <id>docker</id>
51             <activation>
52                 <activeByDefault>false</activeByDefault>
53             </activation>
54             <build>
55                 <pluginManagement>
56                     <plugins>
57                         <plugin>
58                             <groupId>com.google.cloud.tools</groupId>
59                             <artifactId>jib-maven-plugin</artifactId>
60                             <version>${jib-maven-plugin.version}</version>
61                             <configuration>
62                                 <container>
63                                     <mainClass>${app}</mainClass>
64                                     <creationTime>USE_CURRENT_TIMESTAMP</creationTime>
65                                 </container>
66                                 <from>
67                                     <image>${base.image}</image>
68                                 </from>
69                                 <to>
70                                     <image>${repository.name}</image>
71                                     <tags>
72                                         <tag>${tag.version}</tag>
73                                     </tags>
74                                 </to>
75                             </configuration>
76                             <executions>
77                                 <execution>
78                                     <phase>package</phase>
79                                     <id>build</id>
80                                     <goals>
81                                         <goal>dockerBuild</goal>
82                                     </goals>
83                                 </execution>
84                                 <execution>
85                                     <phase>deploy</phase>
86                                     <id>buildAndPush</id>
87                                     <goals>
88                                         <goal>build</goal>
89                                     </goals>
90                                 </execution>
91                             </executions>
92                         </plugin>
93                     </plugins>
94                 </pluginManagement>
95             </build>
96         </profile>
97     </profiles>
98
99     <dependencyManagement>
100         <dependencies>
101             <dependency>
102                 <groupId>org.onap.cps</groupId>
103                 <artifactId>cps-dependencies</artifactId>
104                 <version>${project.version}</version>
105                 <type>pom</type>
106                 <scope>import</scope>
107             </dependency>
108             <dependency>
109                 <groupId>org.onap.cps</groupId>
110                 <artifactId>cps-bom</artifactId>
111                 <version>${project.version}</version>
112                 <type>pom</type>
113                 <scope>import</scope>
114             </dependency>
115         </dependencies>
116     </dependencyManagement>
117
118     <build>
119         <resources>
120             <resource>
121                 <directory>src/main/resources</directory>
122                 <filtering>true</filtering>
123             </resource>
124             <resource>
125                 <directory>target/generated-sources/license</directory>
126                 <includes>
127                     <include>third-party-licenses.txt</include>
128                 </includes>
129             </resource>
130             <resource>
131                 <directory>target/generated-resources/licenses</directory>
132                 <includes>
133                     <include>*.*</include>
134                 </includes>
135                 <targetPath>third-party-licenses</targetPath>
136             </resource>
137         </resources>
138         <pluginManagement>
139             <plugins>
140                 <plugin>
141                     <groupId>org.springframework.boot</groupId>
142                     <artifactId>spring-boot-maven-plugin</artifactId>
143                     <version>${spring-boot-maven-plugin.version}</version>
144                     <executions>
145                         <execution>
146                             <goals>
147                                 <goal>build-info</goal>
148                                 <goal>repackage</goal>
149                             </goals>
150                         </execution>
151                     </executions>
152                 </plugin>
153                 <!-- Swagger code generation. -->
154                 <plugin>
155                     <groupId>io.swagger.codegen.v3</groupId>
156                     <artifactId>swagger-codegen-maven-plugin</artifactId>
157                     <version>${swagger-codegen-maven-plugin.version}</version>
158                     <executions>
159                         <execution>
160                             <goals>
161                                 <goal>generate</goal>
162                             </goals>
163                             <configuration>
164                                 <inputSpec>${project.basedir}/docs/api/swagger/openapi.yml</inputSpec>
165                                 <invokerPackage>org.onap.cps.rest.controller</invokerPackage>
166                                 <modelPackage>org.onap.cps.rest.model</modelPackage>
167                                 <apiPackage>org.onap.cps.rest.api</apiPackage>
168                                 <language>spring</language>
169                                 <generateSupportingFiles>false</generateSupportingFiles>
170                                 <configOptions>
171                                     <sourceFolder>src/gen/java</sourceFolder>
172                                     <dateLibrary>java11</dateLibrary>
173                                     <interfaceOnly>true</interfaceOnly>
174                                     <useTags>true</useTags>
175                                 </configOptions>
176                             </configuration>
177                         </execution>
178                     </executions>
179                 </plugin>
180             </plugins>
181         </pluginManagement>
182         <plugins>
183             <plugin>
184                 <groupId>org.apache.maven.plugins</groupId>
185                 <artifactId>maven-compiler-plugin</artifactId>
186                 <configuration>
187                     <source>${java.version}</source>
188                     <target>${java.version}</target>
189                 </configuration>
190             </plugin>
191             <plugin>
192                 <groupId>org.apache.maven.plugins</groupId>
193                 <artifactId>maven-checkstyle-plugin</artifactId>
194                 <executions>
195                     <execution>
196                         <id>onap-java-style</id>
197                         <goals>
198                             <goal>check</goal>
199                         </goals>
200                         <phase>process-sources</phase>
201                         <configuration>
202                             <configLocation>onap-checkstyle/onap-java-style.xml</configLocation>
203                             <sourceDirectories>${project.build.sourceDirectory}</sourceDirectories>
204                             <includeResources>true</includeResources>
205                             <includeTestSourceDirectory>true</includeTestSourceDirectory>
206                             <includeTestResources>true</includeTestResources>
207                             <consoleOutput>false</consoleOutput>
208                             <violationSeverity>warning</violationSeverity>
209                             <failOnViolation>true</failOnViolation>
210                         </configuration>
211                     </execution>
212                 </executions>
213                 <dependencies>
214                     <dependency>
215                         <groupId>org.onap.oparent</groupId>
216                         <artifactId>checkstyle</artifactId>
217                         <version>${oparent.version}</version>
218                     </dependency>
219                 </dependencies>
220             </plugin>
221             <!-- Mandatory plugins for using Spock -->
222             <plugin>
223                 <!-- The gmavenplus plugin is used to compile Groovy code.
224                     To learn more about this plugin, visit https://github.com/groovy/GMavenPlus/wiki -->
225                 <groupId>org.codehaus.gmavenplus</groupId>
226                 <artifactId>gmavenplus-plugin</artifactId>
227                 <version>1.9.0</version>
228                 <executions>
229                     <execution>
230                         <goals>
231                             <goal>compileTests</goal>
232                         </goals>
233                     </execution>
234                 </executions>
235             </plugin>
236             <!-- Required because names of spec classes don't match default
237                 Surefire patterns (`*Test` etc.) -->
238             <plugin>
239                 <groupId>org.apache.maven.plugins</groupId>
240                 <artifactId>maven-surefire-plugin</artifactId>
241                 <version>3.0.0-M5</version>
242                 <configuration>
243                     <useFile>false</useFile>
244                     <includes>
245                         <include>**/*Spec.java</include>
246                         <include>**/*Test.java</include> <!-- Just in case of having also "normal" JUnit tests -->
247                     </includes>
248                 </configuration>
249             </plugin>
250             <plugin>
251                 <groupId>com.google.cloud.tools</groupId>
252                 <artifactId>jib-maven-plugin</artifactId>
253                 <version>${jib-maven-plugin.version}</version>
254                 <configuration>
255                     <container>
256                         <mainClass>${app}</mainClass>
257                         <creationTime>USE_CURRENT_TIMESTAMP</creationTime>
258                     </container>
259                     <from>
260                         <image>${base.image}</image>
261                     </from>
262                     <to>
263                         <image>${repository.name}</image>
264                         <tags>
265                             <tag>${tag.version}</tag>
266                         </tags>
267                     </to>
268                 </configuration>
269             </plugin>
270         </plugins>
271     </build>
272 </project>