java - 无法将插件目标绑定(bind)到 Maven 生命周期阶段

标签 java maven aspectj aspectj-maven-plugin

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

My 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>

最佳答案

确保这些插件不是在 project/build/pluginManagement/plugins 中定义的,而是在 project/build/plugins 中定义的。 只有后者被执行,然后这些插件将通过pluginManagement检查最终配置。

关于java - 无法将插件目标绑定(bind)到 Maven 生命周期阶段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18557245/

相关文章:

java - 使用java读取文本文件中一定数量的行

android - 通过gradle导入时运行时找不到Kotlin反射实现

java - 如何在 IntelliJ 中正确创建简单的命令行 Spring 应用程序?

java - Struts 1 和 Spring AOP

java - ConcurrentHashMap中Bucket级锁和Segment级锁的区别?

java - 多对多关系的空连接表

java - 使用 @RequestBody 模型对象中的 sql.timestamp 变量调用休息服务

java - 使用 Spring @Profile 加载 log4j2 xml 配置而不是 maven <profile>

aspectj - 警告 javax.* 类型没有被编织,因为未指定编织器选项 '-Xset:weaveJavaxPackages=true'

java - spectj-maven-plugin,声明soft如何编译