Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ...
- <groupId>lib.example</groupId>
- <artifactId>jdbc</artifactId>
- <version>1.0.0</version>
- <packaging>jar</packaging>
- ...
- <properties>
- ...
- <mysql.port>3306</mysql.port>
- <mysql.database>testDb</mysql.database>
- <mysql.user>root</mysql.user>
- <mysql.pass>password</mysql.pass>
- </properties>
- ...
- <build>
- ...
- <plugins>
- ...
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>sql-maven-plugin</artifactId>
- <version>1.5</version>
- <dependencies>
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>5.1.44</version>
- </dependency>
- </dependencies>
- <configuration>
- <driver>com.mysql.jdbc.Driver</driver>
- <url>jdbc:mysql://${mysql.host}:${mysql.port}/${mysql.database}?useSSL=false</url>
- <username>${mysql.user}</username>
- <password>${mysql.pass}</password>
- <settingsKey>sensibleKey</settingsKey>
- <!--all executions are ignored if -Dmaven.test.skip=true-->
- <skip>${maven.test.skip}</skip>
- </configuration>
- <executions>
- <execution>
- <id>create-db</id>
- <phase>process-test-resources</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- <configuration>
- <url>jdbc:mysql://${mysql.host}:${mysql.port}?useSSL=false</url>
- <autocommit>true</autocommit>
- <sqlCommand>create database if not exists `${mysql.database}`</sqlCommand>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- <groupId>com.example</groupId>
- <artifactId>project</artifactId>
- <version>0.0.1</version>
- ...
- <properties>
- ...
- <mysql.port>3306</mysql.port>
- <mysql.database>testDb</mysql.database>
- <mysql.user>root</mysql.user>
- <mysql.pass>password</mysql.pass>
- </properties>
- ...
- <dependencies>
- ...
- <dependency>
- <groupId>lib.example</groupId>
- <artifactId>jdbc</artifactId>
- <version>1.0.0</version>
- </dependency>
- ...
- </dependencies>
- ...
- <build>
- <finalName>${project.artifactId}</finalName>
- <plugins>
- ...
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>sql-maven-plugin</artifactId>
- <version>1.5</version>
- <dependencies>
- <dependency>
- <groupId>mysql</groupId>
- <artifactId>mysql-connector-java</artifactId>
- <version>5.1.44</version>
- </dependency>
- </dependencies>
- <configuration>
- <driver>com.mysql.jdbc.Driver</driver>
- <url>jdbc:mysql://${mysql.host}:${mysql.port}?useSSL=false</url>
- <username>${mysql.user}</username>
- <password>${mysql.pass}</password>
- <settingsKey>sensibleKey</settingsKey>
- <!--all executions are ignored if -Dmaven.test.skip=true-->
- <skip>${maven.test.skip}</skip>
- </configuration>
- <executions>
- <execution>
- <id>drop-db-before-test-if-any</id>
- <phase>process-test-resources</phase>
- <goals>
- <goal>execute</goal>
- </goals>
- <configuration>
- <url>jdbc:mysql://${mysql.host}:${mysql.port}?useSSL=false</url>
- <autocommit>true</autocommit>
- <sqlCommand>drop database if exists `${mysql.database}`</sqlCommand>
- <sqlCommand>create database `${mysql.database}`</sqlCommand>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
Add Comment
Please, Sign In to add comment