在当前项目中找不到前缀“帮助”的插件

问题描述

我正在使用 azure 构建管道来打包我的代码,并使用 maven 来编译我的代码,但是我遇到了以下错误

2021-03-02T09:38:48.1737056Z Downloading from central: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/3.1/maven-compiler-plugin-3.1.pom
2021-03-02T09:38:48.1737158Z [WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-compiler-plugin:3.1: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies Could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-compiler-plugin:jar:3.1
2021-03-02T09:38:48.1737237Z Downloading from central: https://repo.maven.apache.org/maven2/org/codehaus/mojo/flatten-maven-plugin/1.0.0/flatten-maven-plugin-1.0.0.pom
2021-03-02T09:38:48.1737345Z [WARNING] Failed to retrieve plugin descriptor for org.codehaus.mojo:flatten-maven-plugin:1.0.0: Plugin org.codehaus.mojo:flatten-maven-plugin:1.0.0 or one of its dependencies Could not be resolved: Failed to read artifact descriptor for org.codehaus.mojo:flatten-maven-plugin:jar:1.0.0

2021-03-02T09:38:48.1747396Z [INFO] BUILD FAILURE
2021-03-02T09:38:48.1747597Z [INFO] ------------------------------------------------------------------------
2021-03-02T09:38:48.1747769Z [INFO] Total time:  05:16 min
2021-03-02T09:38:48.1747937Z [INFO] Finished at: 2021-03-02T09:38:48Z
2021-03-02T09:38:48.1748208Z [INFO] ------------------------------------------------------------------------
2021-03-02T09:38:48.1748988Z [ERROR] No plugin found for prefix 'help' in the current project and in the plugin groups [org.apache.maven.plugins,org.codehaus.mojo] available from the repositories [local (C:\Users\testuser\.m2\repository),central (https://repo.maven.apache.org/maven2)] -> [Help 1]
2021-03-02T09:38:48.1749191Z [ERROR]```

解决方法

你可以尝试直接在pom中使用插件,例如:

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.3</version>
            <configuration>
                <source>1.8</source>
                <target>1.8</target>
                <testSource>1.8</testSource>
                <testTarget>1.8</testTarget>
                <compilerArgument>-Xlint:deprecation</compilerArgument>
            </configuration>
        </plugin>
    </plugins>
</build>