Maven中的org.powermock.modules.junit4.PowerMockRunner类

时间:2016-10-04 09:08:51

标签: maven spring-mvc mockito powermock powermockito

我想在我的测试中使用类org.powermock.modules.junit4.PowerMockRunner但是无法在maven中找到它

<dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-module-junit4</artifactId>
            <version>1.6.5</version>
        </dependency>       
        <dependency>
            <groupId>org.powermock</groupId>
            <artifactId>powermock-api-mockito</artifactId>
            <version>1.6.5</version>
        </dependency>
        <dependency>
            <groupId>org.powermock.tests</groupId>
            <artifactId>powermock-tests-utils</artifactId>
            <version>1.6.5</version>
        </dependency>

我也试过添加

<dependency>
    <groupId>org.powermock</groupId>
    <artifactId>powermock-mockito-release-full</artifactId>
    <version>1.4.9</version>
</dependency>

但是我得到了错误:

Missing artifact org.powermock:powermock-mockito-release-full:jar:1.4.9

我也尝试在本地安装它,结果相同

mvn install:install-file -Dfile=C:\tmp\migration\lib\mockito\powermock-mockito-1.5.4-full.jar -DgroupId=org.powermock -DartifactId=powermock-mockito-release-full -Dversion=1.5.4 -Dpackaging=jar

我也将pom更改为

<dependency>
    <groupId>org.powermock</groupId>
    <artifactId>powermock-mockito-release-full</artifactId>
    <version>1.5.4</version>
    <scope>test</scope>
    <type>pom</type>
</dependency>

但我仍然有错误:

Multiple markers at this line
    - Class<PowerMockRunner> cannot be resolved 
     to a type

正在运行

mvn test

这就是结果

Tests run: 109, Failures: 109, Errors: 0, Skipped: 0, Time elapsed: 1.235 sec <<< FAILURE!

0 个答案:

没有答案