MAVEN学习笔记之Maven插件的应用(4)

MAVEN学习笔记之Maven插件的应用(4)

<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>sql-maven-plugin</artifactId>
                <version>1.5</version>

                <!-- 使用插件依然可以指定相应的依赖 -->
                <dependencies>
                    <dependencie>
                    <groupId>mysql</groupId>
                    <artifactId>mysql-connector-java</artifactId>
                    <version>5.1.24</version>

            <!-- 配置参数 -->
            <configuration>
                <driver>${jdbc.driver}</driver>
                <url>${jdbc.url}</url>
                <username>${jdbc.username}</username>
                <password>${jdbc.password}</password>
            </configuration>
            <executions>
            <!--插件执行时间-->
            <execution>
                <id>create-db</id>
                <phase>compile</phase>
                <goals><goal>execut</goal></goals>
                <!--帮助文档中找-->
                <configuration>
                    <sqlCommand>create database IF NOT EXIt itat_maven_test</sqlCommand>
                </configuration>
                </execution>
            </executions>
            </plugin>
        </plugins>
    </pluginManagement>
</build>
原文地址:https://www.cnblogs.com/lanzhi/p/6467992.html