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

2019-05-26 21:29:45 浏览数 (1)

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

代码语言:javascript复制
<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>

0 人点赞