简体   繁体   English

无法将插件目标绑定到Maven生命周期阶段

[英]Not able to bind plugin goals to maven lifecycle phases

I am using maven sql plugin. 我正在使用Maven SQL插件。 I am using the plugin to setup the my test db before executing integration tests. 我正在使用插件在执行集成测试之前设置我的测试数据库。 Here is my plugin configuration from my project pom. 这是我的项目pom中的插件配置。 When I execute mvn clean install I expect the plugin goals to execute. 当我执行mvn clean install我希望插件目标能够执行。 But they are not getting executed. 但是他们没有被执行。 Any help will be appreciated. 任何帮助将不胜感激。 I am facing similar issue for aspectj plugin (configuration provided below). 我遇到了AspectJ插件的类似问题(下面提供的配置)。

My SQL plugin configuration: 我的SQL插件配置:

<!-- Maven SQL Plugin for setting up test schema for integration tests -->
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>sql-maven-plugin</artifactId>
    <version>1.5</version>
    <dependencies> <!-- specify the dependent JDBC driver here -->
        <dependency>
            <groupId>${jdbc.groupId}</groupId>
            <artifactId>${jdbc.artifactId}</artifactId>
            <version>${jdbc.version}</version>
        </dependency>
    </dependencies>
    <!-- common configuration shared by all executions -->
    <configuration>
        <driver>org.hsqldb.jdbcDriver</driver>
        <url>jdbc:hsqldb:sample</url>
        <username>sa</username>
        <password></password>
    </configuration>

    <executions>
        <execution>
            <id>create_db_schema</id>
            <phase>process-test-resources</phase>
            <goals>
                <goal>execute</goal>
            </goals>
            <!-- specific configuration for this execution -->
            <configuration>
                <srcFiles>
                    <srcFile>src/test/resources/test-schema.sql</srcFile>
                </srcFiles>
            </configuration>
        </execution>
        <execution>
            <id>shutdown_db_instance</id>
            <phase>process-test-resources</phase>
            <goals>
                <goal>execute</goal>
            </goals>
            <configuration>
                <sqlCommand>SHUTDOWN IMMEDIATELY</sqlCommand>
            </configuration>
         </execution>
     </executions>
</plugin>

My aspectj plugin configuration: 我的aspectj插件配置:

<!-- AspectJ Compile-time waving for spring cross-store. -->
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>aspectj-maven-plugin</artifactId>
    <version>1.4</version>
    <executions>
        <execution>
            <goals>
                <goal>compile</goal> 
                <goal>test-compile</goal> 
            </goals>
        </execution>
    </executions>
    <configuration>
        <outxml>true</outxml>
        <showWeaveInfo>true</showWeaveInfo>
        <aspectLibraries>
            <aspectLibrary>
                <groupId>org.springframework</groupId>
                <artifactId>spring-aspects</artifactId>
            </aspectLibrary>
            <aspectLibrary>
                <groupId>org.springframework.data</groupId>
                <artifactId>spring-data-mongodb-cross-store</artifactId>
            </aspectLibrary>
        </aspectLibraries>
        <source>1.6</source>
        <target>1.6</target>
    </configuration>
</plugin>

Be sure that these plugins are not defined inside project/build/pluginManagement/plugins , but in project/build/plugins . 确保未在project/build/pluginManagement/plugins定义这些插件,而是在project/build/plugins定义了这些project/build/plugins Only the latter are executed, those plugins will then will be checked with the pluginManagement for the final configuration. 仅执行后者,然后将使用pluginManagement检查这些插件的最终配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM