当前位置: 首页 > 知识库问答 >
问题:

无法执行目标org.apache.maven.plugins:maven-site-plugin:

苗阳
2023-03-14

尝试使用Maven3生成MVN站点失败,我无法了解原因。使用以下命令调用站点生成:

mvn3 -e clean site -Pmetrics

结果如下:

我的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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>edu.una.miscenarios</groupId>
    <artifactId>mi-scenarios</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>
    <name>mi-scenarios</name>
    <url>http://maven.apache.org</url>
    <properties>
        <additionalparam>-Xdoclint:none</additionalparam>
    </properties>
    <build>
        <pluginManagement>
            <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>
                    </configuration>
                </plugin>
                <plugin>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <configuration>
                        <archive>
                            <manifest>
                                <mainClass>edu.una.miscenarios.start.Start</mainClass>
                            </manifest>
                        </archive>
                        <descriptorRefs>
                            <descriptorRef>jar-with-dependencies</descriptorRef>
                        </descriptorRefs>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.javatuples</groupId>
            <artifactId>javatuples</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.12</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <version>1.7.12</version>
        </dependency>
        <dependency>
            <groupId>edu.gmu.cs</groupId>
            <artifactId>mason</artifactId>
            <version>19.0</version>
        </dependency>
        <dependency>
            <groupId>edu.gmu.cs</groupId>
            <artifactId>ecj</artifactId>
            <version>23.0</version>
        </dependency>
        <dependency>
            <groupId>infodynamics</groupId>
            <artifactId>infodynamics</artifactId>
            <version>1.3</version>
        </dependency>
        <dependency>
            <groupId>edu.una.dependencylib</groupId>
            <artifactId>dependencylib</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>18.0</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
        </dependency>
    </dependencies>
    <reporting>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>findbugs-maven-plugin</artifactId>
                <version>3.0.2</version>
                <configuration>
                    <xmlOutput>true</xmlOutput>
                    <effort>Max</effort>
                    <failOnError>false</failOnError>
                    <sourceEncoding>${file.encoding}</sourceEncoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>2.17</version>
                <reportSets>
                    <reportSet>
                        <reports>
                            <report>checkstyle</report>
                        </reports>
                    </reportSet>
                </reportSets>
            </plugin>
        </plugins>
    </reporting>
    <profiles>
        <profile>
            <id>metrics</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>2.10.3</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>aggregate</goal>
                                </goals>
                                <configuration>
                                    <additionalparam>-Xdoclint:none</additionalparam>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>findbugs-maven-plugin</artifactId>
                        <version>3.0.2</version>
                        <configuration>
                            <xmlOutput>true</xmlOutput>
                            <findbugsXmlWithMessages>true</findbugsXmlWithMessages>
                            <failOnError>false</failOnError>
                        </configuration>
                        <executions>
                            <execution>
                                <id>run-findbugs</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-checkstyle-plugin</artifactId>
                        <version>2.17</version>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>check</goal>
                                </goals>
                                <phase>verify</phase>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>cobertura-maven-plugin</artifactId>
                        <version>2.7</version>
                        <configuration>
                            <formats>
                                <format>xml</format>
                                <format>html</format>
                            </formats>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>cobertura</goal>
                                </goals>
                                <phase>verify</phase>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>

共有1个答案

宋烨烁
2023-03-14

该错误可能是由maven checkstyle插件引起的。查看构建输出中的以下行:

java.lang.IllegalStateException: No match found at java.util.regex.Matcher.group(Matcher.java:536) at com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.getMultilineNoArgTags(JavadocMethodCheck.java:669) 

这是真正的错误。如果错误与这里和这里描述的相同,那么当遇到一个@returnjavadoc标记(后面没有任何文本)时,这就是插件的一个bug。

解决方案:在@return标记后添加文本可以解决这个问题,顺便说一句,这是一个很好的做法,让javadoc正确地填充正确的信息:)

快速测试:删除checkstyle插件并再次运行它。如果它起作用,那么您就隔离了问题,然后查找不带文本的@return标记并修复它们。

 类似资料: