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

时间:2013-09-01 09:54:19

标签: java maven aspectj aspectj-maven-plugin

我正在使用maven sql插件。我在执行集成测试之前使用插件来设置我的测试数据库。这是我的项目pom中的插件配置。当我执行mvn clean install时,我希望执行插件目标。但他们没有被处决。任何帮助将不胜感激。我面临类似的aspectj插件问题(下面提供的配置)。

我的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>

我的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>

1 个答案:

答案 0 :(得分:4)

确保这些插件未在project/build/pluginManagement/plugins内定义,但在project/build/plugins中定义。 只执行后者,然后将使用pluginManagement检查这些插件以进行最终配置。