p2-maven-plugin因hadoop而失败

时间:2016-01-06 13:05:09

标签: maven hadoop p2

如果我将hadoop-annotations包含为(传递)依赖项,则使用mvn p2:site运行p2-maven-plugin会失败:

[info] Executing Bundler:
[info]   [EXEC] hadoop-common-2.7.1.jar
[warn]  : Superfluous export-package instructions: [org.apache, org.apache.hadoop.io.file, org]
[info] Executing Bundler:
[info]   [EXEC] hadoop-annotations-2.7.1.jar
[warn]  : Superfluous export-package instructions: [org.apache.hadoop, org, org.apache]
[info] Executing Bundler:
[info]   [EXEC] tools.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.235 s
[INFO] Finished at: 2016-01-06T13:09:37+01:00
[INFO] Final Memory: 25M/303M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.reficio:p2-maven-plugin:1.2.0-SNAPSHOT:site (default-cli) on project com.incquerylabs.capellabenchmark.dependencies: Execution default-cli of goal org.reficio:p2-maven-plugin:1.2.0-SNAPSHOT:site failed: java.lang.RuntimeException: Error while bundling jar or source: tools.jar: /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre/../lib/tools.jar.78edbbdc-bfbf-46f3-8f9b-35681a60baf5 (Permission denied) -> [Help 1]

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

hadoop-annotations取决于JDK jar:

<dependency>
  <groupId>jdk.tools</groupId>
  <artifactId>jdk.tools</artifactId>
  <version>1.6</version>
  <scope>system</scope>
  <systemPath>${java.home}/../lib/tools.jar</systemPath>
</dependency>

您必须在p2-maven-plugin配置中排除它:

<artifact>
    <id>{artifact that depends on hadoop-annotations}</id>
    <excludes>
        <exclude>jdk.tools:jdk.tools</exclude> <!-- workaround for hadoop-annotations -->
    </excludes>
</artifact>