You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by hu...@apache.org on 2012/09/22 11:30:03 UTC

[2/2] git commit: Add cloud database creation to maven, use mvn -P developer -pl developer -Ddeploydb

Add cloud database creation to maven, use mvn -P developer -pl developer
-Ddeploydb

Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/4c38152a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/4c38152a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/4c38152a

Branch: refs/heads/master
Commit: 4c38152afeea946e4708037b924973931b20cf19
Parents: 66dc718
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Sat Sep 22 11:28:33 2012 +0200
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Sat Sep 22 11:28:33 2012 +0200

----------------------------------------------------------------------
 developer/pom.xml |  143 ++++++++++++++++++++++++++++++++++++++++++++++++
 pom.xml           |    6 ++
 2 files changed, 149 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4c38152a/developer/pom.xml
----------------------------------------------------------------------
diff --git a/developer/pom.xml b/developer/pom.xml
new file mode 100644
index 0000000..3270977
--- /dev/null
+++ b/developer/pom.xml
@@ -0,0 +1,143 @@
+<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor 
+	license agreements. See the NOTICE file distributed with this work for additional 
+	information regarding copyright ownership. The ASF licenses this file to 
+	you 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>
+	<groupId>org.apache.cloudstack</groupId>
+	<artifactId>cloud-developer</artifactId>
+	<name>Apache CloudStack Developer Tools</name>
+	<packaging>pom</packaging>
+	<parent>
+		<groupId>org.apache.cloudstack</groupId>
+		<artifactId>cloudstack</artifactId>
+		<version>4.0.0-SNAPSHOT</version>
+	</parent>
+	<dependencies>
+		<dependency>
+			<groupId>mysql</groupId>
+			<artifactId>mysql-connector-java</artifactId>
+			<version>5.1.21</version>
+			<scope>runtime</scope>
+		</dependency>
+	</dependencies>
+	<build>
+		<defaultGoal>install</defaultGoal>
+	</build>
+
+	<profiles>
+		<profile>
+			<id>deploydb</id>
+			<activation>
+				<property>
+					<name>deploydb</name>
+				</property>
+			</activation>
+			<build>
+				<plugins>
+					<plugin>
+						<groupId>org.codehaus.mojo</groupId>
+						<artifactId>properties-maven-plugin</artifactId>
+						<version>1.0-alpha-2</version>
+						<executions>
+							<execution>
+								<phase>initialize</phase>
+								<goals>
+									<goal>read-project-properties</goal>
+								</goals>
+								<configuration>
+									<files>
+										<file>${project.parent.basedir}/utils/conf/db.properties</file>
+									</files>
+								</configuration>
+							</execution>
+						</executions>
+					</plugin>
+					<plugin>
+						<artifactId>maven-antrun-plugin</artifactId>
+						<version>1.7</version>
+						<executions>
+							<execution>
+								<phase>generate-resources</phase>
+								<goals>
+									<goal>run</goal>
+								</goals>
+								<configuration>
+									<target>
+										<filter token="VERSION" value="${project.version}" />
+										<copy todir="${basedir}/target/db" filtering="true">
+											<fileset dir="${project.basedir}/../setup/db/">
+											</fileset>
+										</copy>
+									</target>
+								</configuration>
+							</execution>
+						</executions>
+					</plugin>
+					<plugin>
+						<groupId>org.codehaus.mojo</groupId>
+						<artifactId>sql-maven-plugin</artifactId>
+						<version>1.5</version>
+						<dependencies>
+							<!-- specify the dependent jdbc driver here -->
+							<dependency>
+								<groupId>mysql</groupId>
+								<artifactId>mysql-connector-java</artifactId>
+								<version>${cs.mysql.version}</version>
+							</dependency>
+						</dependencies>
+						<configuration>
+							<driver>org.gjt.mm.mysql.Driver</driver>
+							<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}/cloud</url>
+							<username>${db.cloud.username}</username>
+							<password>${db.cloud.password}</password>
+							<!--all executions are ignored if -Dmaven.test.skip=true -->
+							<skip>${maven.test.skip}</skip>
+							<forceMojoExecution>true</forceMojoExecution>
+						</configuration>
+
+						<executions>
+							<execution>
+								<id>create-database</id>
+								<phase>process-test-resources</phase>
+								<goals>
+									<goal>execute</goal>
+								</goals>
+								<configuration>
+									<username>root</username>
+									<password>${db.cloud.password}</password>
+									<url>jdbc:mysql://${db.cloud.host}:${db.cloud.port}</url>
+									<sqlCommand>drop database if exists `cloud`</sqlCommand>
+									<sqlCommand>create database `cloud`</sqlCommand>
+									<!-- <onError>continue</onError> -->
+								</configuration>
+							</execution>
+							<execution>
+								<id>create-schema</id>
+								<phase>process-test-resources</phase>
+								<goals>
+									<goal>execute</goal>
+								</goals>
+								<configuration>
+									<srcFiles>
+										<srcFile>${basedir}/target/db/create-schema.sql</srcFile>
+										<srcFile>${basedir}/target/db/templates.sql</srcFile>
+										<srcFile>${basedir}/target/db/create-index-fk.sql</srcFile>
+									</srcFiles>
+								</configuration>
+							</execution>
+						</executions>
+					</plugin>
+				</plugins>
+			</build>
+		</profile>
+	</profiles>
+
+</project>

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/4c38152a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 3bb8830..80bc545 100644
--- a/pom.xml
+++ b/pom.xml
@@ -303,6 +303,12 @@
         <module>deps</module>
       </modules>
     </profile>
+    <profile>
+      <id>developer</id>
+      <modules>
+        <module>developer</module>
+      </modules>
+    </profile>
   </profiles>
 
 </project>