pre: OpenCV 3.4.19 (version++)
[platform/upstream/opencv.git] / platforms / maven / opencv / pom.xml
1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2          xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3     <modelVersion>4.0.0</modelVersion>
4     <parent>
5         <groupId>org.opencv</groupId>
6         <artifactId>opencv-parent</artifactId>
7         <version>3.4.19</version>
8     </parent>
9     <groupId>org.opencv</groupId>
10     <artifactId>opencv</artifactId>
11     <packaging>bundle</packaging>
12     <name>OpenCV</name>
13
14     <properties>
15         <source.path>../../..</source.path>
16         <build.directory>${source.path}/build</build.directory>
17         <nativelibrary.name>libopencv_java${lib.version.string}.so</nativelibrary.name>
18         <resources.directory>${build.directory}/src</resources.directory>
19     </properties>
20     <build>
21         <directory>../../../build/maven/opencv/target</directory>
22         <outputDirectory>../../../build/src</outputDirectory>
23         <sourceDirectory>../../../build/src</sourceDirectory>
24         <plugins>
25             <plugin>
26                 <groupId>org.apache.maven.plugins</groupId>
27                 <artifactId>maven-clean-plugin</artifactId>
28                 <version>3.0.0</version>
29                 <configuration>
30                     <filesets>
31                         <fileset>
32                             <directory>${build.directory}</directory>
33                         </fileset>
34                     </filesets>
35                 </configuration>
36             </plugin>
37             <plugin>
38                 <groupId>org.codehaus.mojo</groupId>
39                 <artifactId>exec-maven-plugin</artifactId>
40                 <version>1.4.0</version>
41                 <executions>
42                     <execution>
43                         <id>get-opencv-version</id>
44                         <phase>generate-resources</phase>
45                         <goals>
46                             <goal>exec</goal>
47                         </goals>
48                         <configuration>
49                             <executable>bash</executable>
50                             <workingDirectory>${project.basedir}/scripts</workingDirectory>
51                             <arguments>
52                                 <argument>properties</argument>
53                                 <argument>${build.directory}</argument>
54                                 <argument>build.properties</argument>
55                             </arguments>
56                         </configuration>
57                     </execution>
58                     <execution>
59                         <id>setup-environment</id>
60                         <phase>validate</phase>
61                         <goals>
62                             <goal>exec</goal>
63                         </goals>
64                         <configuration>
65                             <executable>bash</executable>
66                             <workingDirectory>${project.basedir}/scripts</workingDirectory>
67                             <arguments>
68                               <!-- Optional packages should be placed BEFORE required ones
69                               in the following argument list. -->
70                                 <argument>deb_package_check</argument>
71                                 <argument>-olibpng-dev|libpng12-dev</argument>
72                                 <argument>-olibopenjp2-7-dev|libjasper-dev</argument>
73                                 <argument>-opython-dev</argument>
74                                 <argument>-opython-numpy</argument>
75                                 <argument>build-essential</argument>
76                                 <argument>cmake</argument>
77                                 <argument>git</argument>
78                                 <argument>libgtk2.0-dev</argument>
79                                 <argument>pkg-config</argument>
80                                 <argument>libavcodec-dev</argument>
81                                 <argument>libavformat-dev</argument>
82                                 <argument>libswscale-dev</argument>
83                                 <argument>libtbb2</argument>
84                                 <argument>libtbb-dev</argument>
85                                 <argument>libjpeg-dev</argument>
86                                 <argument>libtiff5-dev</argument>
87                                 <argument>libdc1394-22-dev</argument>
88                                 <argument>execstack</argument>
89                                 <argument>ant</argument>
90                             </arguments>
91                         </configuration>
92                     </execution>
93                     <execution>
94                         <id>check-execstack</id>
95                         <phase>process-classes</phase>
96                         <goals>
97                             <goal>exec</goal>
98                         </goals>
99                         <configuration>
100                             <workingDirectory>${project.basedir}/scripts</workingDirectory>
101                             <executable>bash</executable>
102                             <arguments>
103                                 <argument>execstack_check</argument>
104                                 <argument>${build.directory}/lib/libopencv_java${lib.version.string}.so</argument>
105                             </arguments>
106                         </configuration>
107                     </execution>
108                 </executions>
109             </plugin>
110             <plugin>
111                 <artifactId>maven-resources-plugin</artifactId>
112                 <version>3.0.2</version>
113                 <executions>
114                     <execution>
115                         <id>copy-resources</id>
116                         <phase>generate-resources</phase>
117                         <goals>
118                             <goal>copy-resources</goal>
119                         </goals>
120                         <configuration>
121                             <outputDirectory>${resources.directory}</outputDirectory>
122                             <resources>
123                                 <resource>
124                                     <directory>resources</directory>
125                                 </resource>
126                             </resources>
127                         </configuration>
128                     </execution>
129                 </executions>
130             </plugin>
131             <plugin>
132                 <groupId>org.codehaus.mojo</groupId>
133                 <artifactId>properties-maven-plugin</artifactId>
134                 <version>1.0.0</version>
135                 <executions>
136                     <execution>
137                         <id>set-arch-properties</id>
138                         <phase>process-resources</phase>
139                         <goals>
140                             <goal>read-project-properties</goal>
141                         </goals>
142                         <configuration>
143                             <files>
144                                 <file>${build.directory}/build.properties</file>
145                             </files>
146                         </configuration>
147                     </execution>
148                 </executions>
149             </plugin>
150             <plugin>
151                 <groupId>org.apache.maven.plugins</groupId>
152                 <artifactId>maven-enforcer-plugin</artifactId>
153                 <version>1.4.1</version>
154                 <executions>
155                     <execution>
156                         <phase>validate</phase>
157                         <id>enforce-os</id>
158                         <goals>
159                             <goal>enforce</goal>
160                         </goals>
161                         <configuration>
162                             <rules>
163                                 <requireOS>
164                                     <family>unix</family>
165                                     <message>This POM is written to function on UNIX family of OS.
166                                         More specifically it should be a Debian flavour of Linux.</message>
167                                 </requireOS>
168                             </rules>
169                         </configuration>
170                     </execution>
171                     <execution>
172                         <id>enforce-environment</id>
173                         <goals>
174                             <goal>enforce</goal>
175                         </goals>
176                         <configuration>
177                             <rules>
178                                 <requireEnvironmentVariable>
179                                     <level>ERROR</level>
180                                     <variableName>ANT_HOME</variableName>
181                                     <message>$ANT_HOME is not set. Build may fail.</message>
182                                 </requireEnvironmentVariable>
183                                 <requireEnvironmentVariable>
184                                     <level>ERROR</level>
185                                     <variableName>JAVA_HOME</variableName>
186                                     <message>$JAVA_HOME is not set. Build will fail.</message>
187                                 </requireEnvironmentVariable>
188                                 <requireEnvironmentVariable>
189                                     <level>WARN</level>
190                                     <variableName>MAKEFLAGS</variableName>
191                                     <message>No MAKEFLAGS environment variable. Build may be slow.
192 To speed up the build you can try exporting MAKEFLAGS=-jX where X equals the number of parallel builds.</message>
193                                 </requireEnvironmentVariable>
194                             </rules>
195                         </configuration>
196                     </execution>
197                     <execution>
198                         <phase>process-resources</phase>
199                         <id>check-versions-match</id>
200                         <goals>
201                             <goal>enforce</goal>
202                         </goals>
203                         <configuration>
204                             <rules>
205                                 <requireProperty>
206                                     <property>project.version</property>
207                                     <regex>${opencv.version}</regex>
208                                     <regexMessage>The Maven POM version ${project.version} does not match the extracted OpenCV version ${opencv.version}.
209 To correct this please execute the following Maven command from the Maven root directory:
210     mvn versions:set -DnewVersion=$(. ./opencv/scripts/functions &amp;&amp; cd ./opencv/scripts &amp;&amp; extract_version &amp;&amp; echo $REPLY)</regexMessage>
211                                 </requireProperty>
212                             </rules>
213                         </configuration>
214                     </execution>
215                 </executions>
216             </plugin>
217             <plugin>
218                 <groupId>org.apache.felix</groupId>
219                 <artifactId>maven-bundle-plugin</artifactId>
220                 <version>2.3.7</version>
221                 <extensions>true</extensions>
222                 <configuration>
223                     <instructions>
224                         <Export-Package>*</Export-Package>
225                         <Bundle-NativeCode>${nativelibrary.name};osname=linux;processor=${osgi.processor}</Bundle-NativeCode>
226                         <Include-Resource>${build.directory}/lib/${nativelibrary.name}</Include-Resource>
227                     </instructions>
228                     <manifestLocation>${build.directory}/manifest</manifestLocation>
229                     <niceManifest>true</niceManifest>
230                 </configuration>
231             </plugin>
232             <plugin>
233                 <groupId>com.googlecode.cmake-maven-project</groupId>
234                 <artifactId>cmake-maven-plugin</artifactId>
235                 <version>3.4.1-b2</version>
236                 <executions>
237                     <execution>
238                         <phase>generate-sources</phase>
239                         <id>cmake-generate</id>
240                         <goals>
241                             <goal>generate</goal>
242                         </goals>
243                         <configuration>
244                             <sourcePath>../../..</sourcePath>
245                             <targetPath>../../../build</targetPath>
246                             <generator>Unix Makefiles</generator>
247                             <options>
248                                 <option>-DBUILD_SHARED_LIBS:BOOL=OFF</option>
249                             </options>
250                         </configuration>
251                     </execution>
252                     <execution>
253                         <phase>generate-sources</phase>
254                         <id>cmake-compile</id>
255                         <goals>
256                             <goal>compile</goal>
257                         </goals>
258                         <configuration>
259                             <target>opencv_java</target>
260                             <projectDirectory>../../../build</projectDirectory>
261                         </configuration>
262                     </execution>
263                 </executions>
264             </plugin>
265             <plugin>
266                 <groupId>org.apache.maven.plugins</groupId>
267                 <artifactId>maven-surefire-plugin</artifactId>
268                 <version>2.15</version>
269             </plugin>
270         </plugins>
271     </build>
272 </project>