尝试使用maven 3生成mvn site
失败,我无法理解。使用以下命令调用网站生成:
mvn3 -e clean site -Pmetrics
结果:
[错误]无法执行目标 org.apache.maven.plugins:maven-site-plugin:3.3:site(default-site)on project mi-scenarios:执行默认目标网站 org.apache.maven.plugins:maven-site-plugin:3.3:站点失败:不匹配 发现 - > [帮助1] org.apache.maven.lifecycle.LifecycleExecutionException:失败 执行目标org.apache.maven.plugins:maven-site-plugin:3.3:site 项目mi-scenarios上的(默认站点):目标的执行默认站点 org.apache.maven.plugins:maven-site-plugin:3.3:站点失败:不匹配 发现于 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224) 在 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 在 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 在 org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116) 在 org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) 在 org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) 在 org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) 在org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)at at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)at at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)at org.apache.maven.cli.MavenCli.execute(mavenCli.java:862)at at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)at at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)at at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 在 sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 在java.lang.reflect.Method.invoke(Method.java:497)at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) 在 org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) 在 org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) 在 org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) 引起:org.apache.maven.plugin.PluginExecutionException:执行 默认目标网站 org.apache.maven.plugins:maven-site-plugin:3.3:站点失败:不匹配 发现于 org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:145) 在 org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) ... 20更多引起:java.lang.IllegalStateException:不匹配 发现于java.util.regex.Matcher.group(Matcher.java:536)at com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.getMultilineNoArgTags(JavadocMethodCheck.java:669) 在 com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.getMethodTags(JavadocMethodCheck.java:598) 在 com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.checkComment(JavadocMethodCheck.java:478) 在 com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocMethodCheck.processAST(JavadocMethodCheck.java:365) 在 com.puppycrawl.tools.checkstyle.checks.AbstractTypeAwareCheck.visitToken(AbstractTypeAwareCheck.java:147) 在 com.puppycrawl.tools.checkstyle.TreeWalker.notifyVisit(TreeWalker.java:388) 在 com.puppycrawl.tools.checkstyle.TreeWalker.processIter(TreeWalker.java:499) 在 com.puppycrawl.tools.checkstyle.TreeWalker.walk(TreeWalker.java:330) 在 com.puppycrawl.tools.checkstyle.TreeWalker.processFiltered(TreeWalker.java:207) 在 com.puppycrawl.tools.checkstyle.api.AbstractFileSetCheck.process(AbstractFileSetCheck.java:79) 在com.puppycrawl.tools.checkstyle.Checker.process(Checker.java:265) 在 org.apache.maven.plugin.checkstyle.exec.DefaultCheckstyleExecutor.executeCheckstyle(DefaultCheckstyleExecutor.java:252) 在 org.apache.maven.plugin.checkstyle.AbstractCheckstyleReport.executeReport(AbstractCheckstyleReport.java:473) 在 org.apache.maven.plugin.checkstyle.CheckstyleReport.executeReport(CheckstyleReport.java:154) 在 org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:255) 在 org.apache.maven.plugins.site.ReportDocumentRenderer.renderDocument(ReportDocumentRenderer.java:219) 在 org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.renderModule(DefaultSiteRenderer.java:319) 在 org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render(DefaultSiteRenderer.java:135) 在 org.apache.maven.plugins.site.SiteMojo.renderLocale(SiteMojo.java:175) 在org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:138) 在 org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) ......还有21个
我的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>
答案 0 :(得分:2)
错误可能是由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)
这是真正的错误。如果错误与描述的here和here相同,那么当遇到@return
javadoc标记时,它就是插件的错误,后面没有任何文本。
解决方案:在@return
标记修复问题后添加文字,顺便说一句,这是一个很好的做法,让javadoc正确填充正确的信息:)
快速测试:删除checkstyle插件并再次运行。如果它有效,那么您将问题隔离,然后查找没有文本的@return
标记并修复它们。