1

我正在为遗留代码编写一些单元测试,它在 java 1.4 编译器设置中。

但是我正在使用 powermock/easymock/junit4 等编写单元测试......这需要 1.5

该项目使用了一个父 pom,它声明源和目标是 1.4 我试图覆盖项目中的以下父 pom 设置,如下所示:

<build> 
    <plugins>   
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.0.2</version>
            <configuration>
                <testSource>1.5</testSource>
                <testTarget>1.5</testTarget>
            </configuration>
         </plugin>
    </plugins>
</build>

但是,它仍然在我的测试文件中显示编译错误,因为注释只能与 JRE 1.5 一起使用

以下是父 pom 设置:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <optimize>true</optimize>
                <showDeprecation>true</showDeprecation>
                <source>1.4</source>
                <target>1.4</target>
            </configuration>
        </plugin>

是否有任何其他设置可以覆盖?

4

0 回答 0