简体   繁体   English

Maven PITest 错误“在当前项目和插件组中找不到前缀 'org.pitest' 的插件”

[英]Maven PITest Error “No plugin found for for prefix 'org.pitest' in the current project and in the plugin groups”

I need to make a mutation test with PITest, but I'm having a hard time trying to install it via Maven, when I try to run PIT to execute mutations and the test case, I receive this error in the cmd:我需要使用 PITest 进行突变测试,但我很难通过 Maven 安装它,当我尝试运行 PIT 来执行突变和测试用例时,我在 cmd 中收到此错误:

"No plugin found for for prefix 'org.pitest' in the current project and in the plugin groups" “在当前项目和插件组中找不到前缀 'org.pitest' 的插件”

Can someone help me solve this problem, please?有人可以帮我解决这个问题吗?

My code:我的代码:

package com.mateus;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Codigo {

    public boolean verify(String word){
        String regex = "^[a-zA-Z0-9_$]+$";
        Pattern pattern = Pattern.compile(regex);
        Matcher matcher = pattern.matcher(word);
        if(word.substring(0, 1).matches("[0-9]")){
            return false;
        }
        return matcher.matches();
    }

}

My Tests:我的测试:

package com.mateus;

import static org.junit.Assert.*;

import org.junit.Test;

public class CodigoTest {
    Codigo c = new Codigo();
    @Test
    public void test() {
        assertEquals(true, c.verify("teste"));
    }
    @Test
    public void test2() {
        assertEquals(false, c.verify("1teste"));
    }
    @Test
    public void test3() {
        assertEquals(false, c.verify("tes@te"));
    }

}

pom.xml: pom.xml:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.mateus</groupId>
  <artifactId>MavenMutacao</artifactId>
  <version>0.0.1-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.13-rc-1</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.pitest</groupId>
                <artifactId>pitest-maven</artifactId>
                <version>1.4.3</version>
                <configuration>
                    <targetClasses>
                        <param>com.mateus*</param>
                    </targetClasses>
                    <targetTests>
                        <param>com.mateus*</param>
                    </targetTests>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

This is the error that appears on my cmd:这是我的 cmd 上出现的错误:

C:\Users\mateu\eclipse-workspace\MavenMutacao>mvn org.pitest:pitest maven:mutationCoverage
[INFO] Scanning for projects...
Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
Downloaded from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml (20 kB at 14 kB/s)
Downloaded from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml (14 kB at 9.3 kB/s)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  2.303 s
[INFO] Finished at: 2019-11-19T16:39:59-02:00
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'org.pitest' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\mateu\.m2\repository), central (https://repo.maven.apache.org/maven2)] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException

You have to use the plugin like this.你必须像这样使用插件。

<plugin>
    <groupId>org.pitest</groupId>
    <artifactId>pitest-maven</artifactId>
    <version>1.4.10</version>
    <configuration>
        <targetClasses>
            <param>com.mateus*</param>
        </targetClasses>
        <targetTests>
            <param>com.mateus*</param>
        </targetTests>
    </configuration>
</plugin>

EIDT: Instead of latest, use the version 1.4.10 See the reference below link. EIDT:使用1.4.10版本而不是最新版本,请参阅下面的参考链接。

https://pitest.org/quickstart/maven/ https://pitest.org/quickstart/maven/

It is also available in maven central, you can check this link.它也可用于 maven 中央,您可以查看此链接。

https://search.maven.org/artifact/org.pitest/pitest-maven/1.4.10/maven-plugin https://search.maven.org/artifact/org.pitest/pitest-maven/1.4.10/maven-plugin

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Maven - 在当前项目和插件组中找不到前缀'tomcat7'的插件 - Maven - No plugin found for prefix 'tomcat7' in the current project and in the plugin groups 错误“在当前项目和插件组中找不到前缀‘原型’的插件”在创建新的 java maven 项目中 - Error "No plugin found for prefix 'archetype' in the current project and in the plugin groups" getting in creating new java maven project 在当前项目和插件组[org.apache.maven.plugins,org.codehaus.mojo]中未找到前缀为&#39;archetype&#39;的插件 - No plugin found for prefix 'archetype' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] local Maven 抛出错误:在当前项目和插件组中找不到前缀“程序集”的插件 - Maven throws error: No plugin found for prefix 'assembly' in the current project and in the plugin groups 在当前项目和插件组[org.apache.maven.plugins,org.codehaus.mojo]中找不到前缀为“ exec”的插件 - No plugin found for prefix 'exec' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] Maven - 在当前项目中找不到前缀&#39;wildfly&#39;的插件 - Maven - No plugin found for prefix 'wildfly' in the current project JavaFX Maven插件:在当前项目和插件组中找不到前缀“ jfx”的插件 - JavaFX Maven Plug-in: No plugin found for prefix 'jfx' in the current project and in the plugin groups Maven-在当前项目和插件组中找不到前缀“spring-boot”的插件 - Maven- No plugin found for prefix 'spring-boot' in the current project and in the plugin groups 在当前项目和插件组中找不到前缀“ jetty”的插件 - No plugin found for prefix 'jetty' in the current project and in the plugin groups 如何修复“在当前项目和插件组中找不到前缀'liquibase'的插件” - How to fix “No plugin found for prefix 'liquibase' in the current project and in the plugin groups”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM