maven和aspectj插件 - 测试挂起

时间:2011-02-16 20:15:10

标签: maven aspectj

我在尝试将我的方面编织到我的应用程序中时使用了aspectj-maven-plugin。我看到的问题是编译和编织似乎运行良好,但每当它进入测试阶段它只是挂起。我已经在我的pom.xml中添加了一个部分

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>aspectj-maven-plugin</artifactId>
            <version>1.3</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
            <executions>
                <execution>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>

<dependencies>
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.16</version>
    </dependency>
    <dependency>
        <groupId>org.aspectj</groupId>
        <artifactId>aspectjrt</artifactId>
        <version>1.6.7</version>
    </dependency>
</dependencies>

这是我得到的输出:

[INFO] Compiling 7 source files to /home/***/target/classes
[INFO] [aspectj:compile {execution: default}]
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/***/src/test/resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Compiling 5 source files to /home/***/target/test-classes
[INFO] [aspectj:test-compile {execution: default}]
[INFO] [surefire:test {execution: default-test}]
[INFO] Surefire report directory: /home/***/surefire-reports

-------------------------------------------------------
  T E S T S
-------------------------------------------------------
Running com.example.MyTest

有没有其他人看到这种行为/知道如何修复它?

1 个答案:

答案 0 :(得分:2)

将此放在这里以防万一有人像我一样。测试挂起的原因是因为方面切入点。

call(* *.*(..))

在此之后,我得到了一个在切入点之前调用的建议。然而,这创造了一个循环条件,并挂了我的测试。卫生署!