Maven Site插件问题

时间:2014-03-25 17:00:07

标签: java maven maven-site-plugin

我下载了Jetty源并尝试运行以下maven命令:

mvn clean compile site -DskipTests -e

但问题是maven-site-plugin不起作用。我使用Maven 3.0.5(也尝试使用最新版本)和maven-site-plugin 3.3。

错误如下所示:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.3:site (default-site) on project jetty-project: failed to get report for org.apache.maven.plugins:maven-javadoc-plugin: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.2:copy-dependencies (copy-lib-deps) on project jetty-ant: Error copying artifact from /jetty/jetty-io/target/classes to /jetty/jetty-ant/target/test-lib/jetty-io-9.1.3-SNAPSHOT.jar: /jetty/jetty-io/target/classes (Is a directory) -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-site-plugin:3.3:site (default-site) on project jetty-project: failed to get report for org.apache.maven.plugins:maven-javadoc-plugin
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: failed to get report for org.apache.maven.plugins:maven-javadoc-plugin
    at org.apache.maven.reporting.exec.DefaultMavenReportExecutor.buildMavenReports(DefaultMavenReportExecutor.java:159)
    at org.apache.maven.plugins.site.AbstractSiteRenderingMojo.getReports(AbstractSiteRenderingMojo.java:235)
    at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:121)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 19 more
Caused by: org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.2:copy-dependencies (copy-lib-deps) on project jetty-ant: Error copying artifact from /jetty/jetty-io/target/classes to /jetty/jetty-ant/target/test-lib/jetty-io-9.1.3-SNAPSHOT.jar
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.MojoExecutor.executeForkedExecutions(MojoExecutor.java:365)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeForkedExecutions(DefaultLifecycleExecutor.java:173)
    at org.apache.maven.reporting.exec.DefaultMavenReportExecutor.buildReportPlugin(DefaultMavenReportExecutor.java:273)
    at org.apache.maven.reporting.exec.DefaultMavenReportExecutor.buildMavenReports(DefaultMavenReportExecutor.java:154)
    ... 23 more
Caused by: org.apache.maven.plugin.MojoExecutionException: Error copying artifact from /jetty/jetty-io/target/classes to /jetty/jetty-ant/target/test-lib/jetty-io-9.1.3-SNAPSHOT.jar
    at org.apache.maven.plugin.dependency.AbstractDependencyMojo.copyFile(AbstractDependencyMojo.java:194)
    at org.apache.maven.plugin.dependency.CopyDependenciesMojo.copyArtifact(CopyDependenciesMojo.java:199)
    at org.apache.maven.plugin.dependency.CopyDependenciesMojo.execute(CopyDependenciesMojo.java:90)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
    ... 29 more
Caused by: java.io.FileNotFoundException: /jetty/jetty-io/target/classes (Is a directory)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:138)
    at org.codehaus.plexus.util.io.FileInputStreamFacade.getInputStream(FileInputStreamFacade.java:78)
    at org.codehaus.plexus.util.FileUtils.copyStreamToFile(FileUtils.java:1024)
    at org.codehaus.plexus.util.FileUtils.copyFile(FileUtils.java:932)
    at org.apache.maven.plugin.dependency.AbstractDependencyMojo.copyFile(AbstractDependencyMojo.java:189)
    ... 33 more
[ERROR] 
[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/MojoExecutionException

插件配置如下所示:

<plugin>
    <artifactId>maven-site-plugin</artifactId>
    <version>3.3</version>
    <executions>
      <execution>
        <id>attach-descriptor</id>
        <goals>
          <goal>attach-descriptor</goal>
        </goals>
      </execution>
    </executions>
</plugin>

所以看起来maven-site-plugin似乎仍然存在一些错误,它不能与Maven 3一起使用。有没有人知道任何解决方法呢?

1 个答案:

答案 0 :(得分:0)

请尝试package而不是compile

说明: Caused by: org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.2:copy-dependencies (copy-lib-deps) on project jetty-ant: Error copying artifact from /jetty/jetty-io/target/classes to /jetty/jetty-ant/target/test-lib/jetty-io-9.1.3-SNAPSHOT.jar

工件尚未打包,因为您只编译了它,因此当尝试在表示目录的路径上复制jar时,m-dependency-p:copy-dependencies失败

当你运行包阶段时,jar会在这里,所以不再有任何问题