得到“无法为com.sun创建Maven项目:tools:pom:1.6 from repository。”在maven中使用findbugs-maven-plugin时发出警告

时间:2014-11-01 15:27:55

标签: java maven findbugs

这是我的pom.xml的<reporting>部分

<reporting>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>findbugs-maven-plugin</artifactId>
            <version>3.0.0</version>
            <configuration>
                <findbugsXmlOutput>true</findbugsXmlOutput>
                <findbugsXmlWithMessages>true</findbugsXmlWithMessages>
                <xmlOutput>true</xmlOutput>
                <excludeFilterFile>findbugs-exclude-filter.xml</excludeFilterFile>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>2.6</version>
        </plugin>
        <plugin>
            <artifactId>maven-project-info-reports-plugin</artifactId>
            <version>2.7</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jxr-plugin</artifactId>
            <version>2.3</version>
        </plugin>
    </plugins>
</reporting>

当我运行&#34; mvn site&#34;时,我收到了警告

[WARNING] Unable to create Maven project for com.sun:tools:pom:1.6 from repository.

以下是警告的背景:

[INFO] Generating "About" report    --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Plugin Management" report    --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Distribution Management" report    --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Dependency Information" report    --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Source Repository" report    --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Mailing Lists" report    --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Issue Tracking" report    --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Continuous Integration" report    --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Project Plugins" report    --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Project License" report    --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Dependency Management" report    --- maven-project-info-reports-plugin:2.7
[WARNING] Unable to create Maven project for com.sun:tools:pom:1.6 from repository.
org.apache.maven.project.ProjectBuildingException: Error resolving project artifact: Failure to find com.sun:tools:pom:1.6 in http://maven.repository.redhat.com/techpreview/all/ was cached in the local repository, resolution will not be reattempted until the update interval of jboss-products-ga-repo has elapsed or updates are forced for project com.sun:tools:pom:1.6
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:299)
    at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromRepository(DefaultMavenProjectBuilder.java:236)
    at org.apache.maven.project.DefaultMavenProjectBuilder.buildFromRepository(DefaultMavenProjectBuilder.java:251)
    at org.apache.maven.report.projectinfo.dependencies.RepositoryUtils.getMavenProjectFromRepository(RepositoryUtils.java:298)
    at org.apache.maven.report.projectinfo.dependencies.renderer.DependencyManagementRenderer.getDependencyRow(DependencyManagementRenderer.java:259)
    at org.apache.maven.report.projectinfo.dependencies.renderer.DependencyManagementRenderer.renderDependenciesForScope(DependencyManagementRenderer.java:207)
    at org.apache.maven.report.projectinfo.dependencies.renderer.DependencyManagementRenderer.renderDependenciesForAllScopes(DependencyManagementRenderer.java:160)
    at org.apache.maven.report.projectinfo.dependencies.renderer.DependencyManagementRenderer.renderSectionProjectDependencies(DependencyManagementRenderer.java:149)
    at org.apache.maven.report.projectinfo.dependencies.renderer.DependencyManagementRenderer.renderBody(DependencyManagementRenderer.java:135)
    at org.apache.maven.reporting.AbstractMavenReportRenderer.render(AbstractMavenReportRenderer.java:79)
    at org.apache.maven.report.projectinfo.DependencyManagementReport.executeReport(DependencyManagementReport.java:112)
    at org.apache.maven.reporting.AbstractMavenReport.generate(AbstractMavenReport.java:190)
    at org.apache.maven.plugins.site.ReportDocumentRenderer.renderDocument(ReportDocumentRenderer.java:219)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.renderModule(DefaultSiteRenderer.java:319)
    at org.apache.maven.doxia.siterenderer.DefaultSiteRenderer.render(DefaultSiteRenderer.java:135)
    at org.apache.maven.plugins.site.SiteMojo.renderLocale(SiteMojo.java:175)
    at org.apache.maven.plugins.site.SiteMojo.execute(SiteMojo.java:138)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:133)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
    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:108)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:76)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:116)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:361)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:155)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:584)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:213)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
    Caused by: org.eclipse.aether.resolution.ArtifactResolutionException: Failure to find com.sun:tools:pom:1.6 in http://maven.repository.redhat.com/techpreview/all/ was cached in the local repository, resolution will not be reattempted until the update interval of jboss-products-ga-repo has elapsed or updates are forced
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:459)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:262)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:239)
    at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:295)
    at org.apache.maven.project.DefaultProjectBuilder.build(DefaultProjectBuilder.java:288)
    ... 37 more
    Caused by: org.eclipse.aether.transfer.ArtifactNotFoundException: Failure to find com.sun:tools:pom:1.6 in http://maven.repository.redhat.com/techpreview/all/ was cached in the local repository, resolution will not be reattempted until the update interval of jboss-products-ga-repo has elapsed or updates are forced
    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.newException(DefaultUpdateCheckManager.java:232)
    at org.eclipse.aether.internal.impl.DefaultUpdateCheckManager.checkArtifact(DefaultUpdateCheckManager.java:206)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.gatherDownloads(DefaultArtifactResolver.java:599)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:518)
    at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:436)
    ... 41 more
[INFO] Generating "Project Team" report    --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Project Summary" report    --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Dependencies" report    --- maven-project-info-reports-plugin:2.7
[INFO] Generating "Source Xref" report    --- maven-jxr-plugin:2.3
[INFO] Generating "Test Source Xref" report    --- maven-jxr-plugin:2.3

我使用的是Java 1.8_u20和maven 3.2.1。

请问有人帮忙解决问题吗?

这里是完整输出日志here

1 个答案:

答案 0 :(得分:0)

你在某个地方使用com.sun:tools吗?此依赖项应包含在系统范围内。

请参阅以下问题:

  

Maven : Missing artifact com.sun:tools:jar:1.6.0 compile time exception in POM.xml

以下是如何正确执行此操作的示例(使用配置文件使其也适用于Mac):

<!--  JDK dependencies  -->
<dependency>
  <groupId>com.sun</groupId>
  <artifactId>tools</artifactId>
  <version>1.6</version>
  <scope>system</scope>
  <systemPath>${tools.jar}</systemPath>
</dependency>
...
<profile>
  <id>default-tools.jar</id>
  <activation>
    <file>
      <exists>${java.home}/../lib/tools.jar</exists>
    </file>
  </activation>
  <properties>
    <tools.jar>${java.home}/../lib/tools.jar</tools.jar>
  </properties>
</profile>
<profile>
  <id>default-tools.jar-mac</id>
  <activation>
    <file>
      <exists>${java.home}/../Classes/classes.jar</exists>
    </file>
  </activation>
  <properties>
    <tools.jar>${java.home}/../Classes/classes.jar</tools.jar>
  </properties>
</profile>