|
1 | | -<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor |
2 | | - license agreements. See the NOTICE file distributed with this work for additional |
3 | | - information regarding copyright ownership. The ASF licenses this file to |
4 | | - you under the Apache License, Version 2.0 (the "License"); you may not use |
5 | | - this file except in compliance with the License. You may obtain a copy of |
6 | | - the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required |
7 | | - by applicable law or agreed to in writing, software distributed under the |
8 | | - License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS |
9 | | - OF ANY KIND, either express or implied. See the License for the specific |
10 | | - language governing permissions and limitations under the License. --> |
| 1 | +<?xml version="1.0" encoding="UTF-8"?><!-- Licensed to the Apache Software |
| 2 | + Foundation (ASF) under one or more contributor license agreements. See the |
| 3 | + NOTICE file distributed with this work for additional information regarding |
| 4 | + copyright ownership. The ASF licenses this file to you under the Apache License, |
| 5 | + Version 2.0 (the "License"); you may not use this file except in compliance |
| 6 | + with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | + Unless required by applicable law or agreed to in writing, software distributed |
| 8 | + under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES |
| 9 | + OR CONDITIONS OF ANY KIND, either express or implied. See the License for |
| 10 | + the specific language governing permissions and limitations under the License. --> |
11 | 11 | <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
12 | 12 | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
13 | 13 | <modelVersion>4.0.0</modelVersion> |
|
34 | 34 |
|
35 | 35 | <profiles> |
36 | 36 | <profile> |
37 | | - <id>deploydb2</id> |
| 37 | + <id>deploydb</id> |
38 | 38 | <activation> |
39 | 39 | <property> |
40 | | - <name>deploydb2</name> |
| 40 | + <name>deploydb</name> |
41 | 41 | </property> |
42 | 42 | </activation> |
43 | 43 | <build> |
44 | 44 | <plugins> |
| 45 | + <plugin> |
| 46 | + <groupId>org.codehaus.mojo</groupId> |
| 47 | + <artifactId>properties-maven-plugin</artifactId> |
| 48 | + <version>1.0-alpha-2</version> |
| 49 | + <executions> |
| 50 | + <execution> |
| 51 | + <phase>initialize</phase> |
| 52 | + <goals> |
| 53 | + <goal>read-project-properties</goal> |
| 54 | + </goals> |
| 55 | + <configuration> |
| 56 | + <files> |
| 57 | + <file>${project.parent.basedir}/utils/conf/db.properties</file> |
| 58 | + <file>${project.parent.basedir}/utils/conf/db.properties.override</file> |
| 59 | + </files> |
| 60 | + <quiet>true</quiet> |
| 61 | + </configuration> |
| 62 | + </execution> |
| 63 | + </executions> |
| 64 | + </plugin> |
| 65 | + <plugin> |
| 66 | + <artifactId>maven-antrun-plugin</artifactId> |
| 67 | + <version>1.7</version> |
| 68 | + <executions> |
| 69 | + <execution> |
| 70 | + <phase>generate-resources</phase> |
| 71 | + <goals> |
| 72 | + <goal>run</goal> |
| 73 | + </goals> |
| 74 | + <configuration> |
| 75 | + <target> |
| 76 | + <filter token="VERSION" value="${project.version}" /> |
| 77 | + <copy todir="${basedir}/target/db" filtering="true"> |
| 78 | + <fileset dir="${project.basedir}/../setup/db/" /> |
| 79 | + |
| 80 | + </copy> |
| 81 | + <copy todir="${basedir}/target/db" filtering="true"> |
| 82 | + <fileset |
| 83 | + dir="${project.basedir}/../awsapi-setup/db/mysql/"> |
| 84 | + <include name="**/*.sql" /> |
| 85 | + </fileset> |
| 86 | + </copy> |
| 87 | + </target> |
| 88 | + </configuration> |
| 89 | + </execution> |
| 90 | + </executions> |
| 91 | + </plugin> |
45 | 92 | <plugin> |
46 | 93 | <groupId>org.codehaus.mojo</groupId> |
47 | 94 | <artifactId>exec-maven-plugin</artifactId> |
|
81 | 128 | </dependencies> |
82 | 129 | <executions> |
83 | 130 | <execution> |
84 | | - <phase>package</phase> |
85 | | - <id>create-database-2</id> |
| 131 | + <phase>process-test-resources</phase> |
| 132 | + <id>create-schema</id> |
86 | 133 | <goals> |
87 | 134 | <goal>java</goal> |
88 | 135 | </goals> |
|
96 | 143 | <artifactId>cloud-server</artifactId> |
97 | 144 | </executableDependency> |
98 | 145 | <mainClass>com.cloud.upgrade.DatabaseCreator</mainClass> |
| 146 | + <arguments> |
| 147 | + <argument>${basedir}/target/db/create-schema.sql</argument> |
| 148 | + <argument>${basedir}/target/db/create-schema-premium.sql</argument> |
| 149 | + <argument>com.cloud.upgrade.DatabaseUpgradeChecker</argument> |
| 150 | + </arguments> |
99 | 151 | </configuration> |
100 | 152 | </plugin> |
| 153 | + <plugin> |
| 154 | + <groupId>org.codehaus.mojo</groupId> |
| 155 | + <artifactId>sql-maven-plugin</artifactId> |
| 156 | + <version>1.5</version> |
| 157 | + <dependencies> |
| 158 | + <!-- specify the dependent jdbc driver here --> |
| 159 | + <dependency> |
| 160 | + <groupId>mysql</groupId> |
| 161 | + <artifactId>mysql-connector-java</artifactId> |
| 162 | + <version>${cs.mysql.version}</version> |
| 163 | + </dependency> |
| 164 | + </dependencies> |
| 165 | + <configuration> |
| 166 | + <driver>org.gjt.mm.mysql.Driver</driver> |
| 167 | + <url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}/cloud</url> |
| 168 | + <username>${db.cloud.username}</username> |
| 169 | + <password>${db.cloud.password}</password> |
| 170 | + <!--all executions are ignored if -Dmaven.test.skip=true --> |
| 171 | + <skip>${maven.test.skip}</skip> |
| 172 | + <forceMojoExecution>true</forceMojoExecution> |
| 173 | + </configuration> |
| 174 | + <executions> |
| 175 | + <execution> |
| 176 | + <id>create-other-schema</id> |
| 177 | + <phase>process-test-resources</phase> |
| 178 | + <goals> |
| 179 | + <goal>execute</goal> |
| 180 | + </goals> |
| 181 | + <configuration> |
| 182 | + <srcFiles> |
| 183 | + <srcFile>${basedir}/target/db/templates.sql</srcFile> |
| 184 | + <srcFile>${basedir}/target/db/create-index-fk.sql</srcFile> |
| 185 | + <srcFile>${basedir}/target/db/cloudbridge_schema.sql</srcFile> |
| 186 | + <srcFile>${basedir}/target/db/cloudbridge_multipart.sql</srcFile> |
| 187 | + <srcFile>${basedir}/target/db/cloudbridge_index.sql</srcFile> |
| 188 | + <srcFile>${basedir}/target/db/cloudbridge_multipart_alter.sql</srcFile> |
| 189 | + <srcFile>${basedir}/target/db/cloudbridge_bucketpolicy.sql</srcFile> |
| 190 | + <srcFile>${basedir}/target/db/cloudbridge_policy_alter.sql</srcFile> |
| 191 | + <srcFile>${basedir}/target/db/cloudbridge_offering.sql</srcFile> |
| 192 | + <srcFile>${basedir}/target/db/cloudbridge_offering_alter.sql</srcFile> |
| 193 | + </srcFiles> |
| 194 | + </configuration> |
| 195 | + </execution> |
| 196 | + <execution> |
| 197 | + <id>prefill-schema</id> |
| 198 | + <phase>process-test-resources</phase> |
| 199 | + <goals> |
| 200 | + <goal>execute</goal> |
| 201 | + </goals> |
| 202 | + <configuration> |
| 203 | + <sqlCommand>INSERT INTO `cloud`.`domain` (id, name, |
| 204 | + parent, path, owner) VALUES (1, 'ROOT', NULL, '/', |
| 205 | + 2)</sqlCommand> |
| 206 | + </configuration> |
| 207 | + </execution> |
| 208 | + <execution> |
| 209 | + <id>prefill-configuration</id> |
| 210 | + <phase>process-test-resources</phase> |
| 211 | + <goals> |
| 212 | + <goal>execute</goal> |
| 213 | + </goals> |
| 214 | + <configuration> |
| 215 | + <sqlCommand>INSERT INTO `cloud`.`configuration` |
| 216 | + (category, instance, component, name, value) VALUES |
| 217 | + ('Hidden', 'DEFAULT', 'management-server', 'init', |
| 218 | + 'false')</sqlCommand> |
| 219 | + </configuration> |
| 220 | + </execution> |
| 221 | + </executions> |
| 222 | + </plugin> |
101 | 223 | </plugins> |
102 | 224 | </build> |
103 | 225 | </profile> |
104 | 226 | <profile> |
105 | | - <id>deploydb</id> |
| 227 | + <id>cleandb</id> |
106 | 228 | <activation> |
107 | 229 | <property> |
108 | | - <name>deploydb</name> |
| 230 | + <name>cleandb</name> |
109 | 231 | </property> |
110 | 232 | </activation> |
111 | 233 | <build> |
|
143 | 265 | <target> |
144 | 266 | <filter token="VERSION" value="${project.version}" /> |
145 | 267 | <copy todir="${basedir}/target/db" filtering="true"> |
146 | | - <fileset dir="${project.basedir}/../setup/db/"> |
147 | | - </fileset> |
| 268 | + <fileset dir="${project.basedir}/../setup/db/" /> |
| 269 | + |
148 | 270 | </copy> |
149 | 271 | <copy todir="${basedir}/target/db" filtering="true"> |
150 | 272 | <fileset |
|
348 | 470 | '${db.cloud.password}';</sqlCommand> |
349 | 471 | </configuration> |
350 | 472 | </execution> |
351 | | - <execution> |
352 | | - <id>create-schema</id> |
353 | | - <phase>process-test-resources</phase> |
354 | | - <goals> |
355 | | - <goal>execute</goal> |
356 | | - </goals> |
357 | | - <configuration> |
358 | | - <srcFiles> |
359 | | - <srcFile>${basedir}/target/db/create-schema.sql</srcFile> |
360 | | - <srcFile>${basedir}/target/db/create-schema-premium.sql</srcFile> |
361 | | - <srcFile>${basedir}/target/db/templates.sql</srcFile> |
362 | | - <srcFile>${basedir}/target/db/create-index-fk.sql</srcFile> |
363 | | - <srcFile>${basedir}/target/db/cloudbridge_schema.sql</srcFile> |
364 | | - <srcFile>${basedir}/target/db/cloudbridge_multipart.sql</srcFile> |
365 | | - <srcFile>${basedir}/target/db/cloudbridge_index.sql</srcFile> |
366 | | - <srcFile>${basedir}/target/db/cloudbridge_multipart_alter.sql</srcFile> |
367 | | - <srcFile>${basedir}/target/db/cloudbridge_bucketpolicy.sql</srcFile> |
368 | | - <srcFile>${basedir}/target/db/cloudbridge_policy_alter.sql</srcFile> |
369 | | - <srcFile>${basedir}/target/db/cloudbridge_offering.sql</srcFile> |
370 | | - <srcFile>${basedir}/target/db/cloudbridge_offering_alter.sql</srcFile> |
371 | | - </srcFiles> |
372 | | - </configuration> |
373 | | - </execution> |
374 | | - <execution> |
375 | | - <id>prefill-schema</id> |
376 | | - <phase>process-test-resources</phase> |
377 | | - <goals> |
378 | | - <goal>execute</goal> |
379 | | - </goals> |
380 | | - <configuration> |
381 | | - <sqlCommand>INSERT INTO `cloud`.`domain` (id, name, |
382 | | - parent, path, owner) VALUES (1, 'ROOT', NULL, '/', |
383 | | - 2)</sqlCommand> |
384 | | - </configuration> |
385 | | - </execution> |
386 | | - <execution> |
387 | | - <id>prefill-configuration</id> |
388 | | - <phase>process-test-resources</phase> |
389 | | - <goals> |
390 | | - <goal>execute</goal> |
391 | | - </goals> |
392 | | - <configuration> |
393 | | - <sqlCommand>INSERT INTO `cloud`.`configuration` |
394 | | - (category, instance, component, name, value) VALUES |
395 | | - ('Hidden', 'DEFAULT', 'management-server', 'init', |
396 | | - 'false')</sqlCommand> |
397 | | - </configuration> |
398 | | - </execution> |
399 | 473 | </executions> |
400 | 474 | </plugin> |
401 | 475 | </plugins> |
|
0 commit comments