首页 > 解决方案 > 执行目标 org.apache.maven.plugins:maven-assembly-plugin:2.5:single failed.: NullPointerException

问题描述

我有一个基于 scala 和 maven 的 spark 项目,我使用插件maven-assembly-plugin将第三方 jar 编译到我的 jar 中。我的 pom.xml 文件中的插件是:

<!--这个插件允许打包时包含上游依赖-->
<plugin>
    <artifactId>maven-assembly-plugin</artifactId>
    <version>2.5</version>
    <configuration>
        <descriptorRefs>
            <descriptorRef>jar-with-dependencies</descriptorRef>
        </descriptorRefs>
    </configuration>
    <executions>
        <execution>
            <id>make-assembly</id>
            <!-- this is used for inheritance merges -->
            <phase>package</phase>
            <!-- bind to the packaging phase -->
            <goals>
                <goal>single</goal>
            </goals>
        </execution>
    </executions>
</plugin>

当我没有添加它时,它运行良好,但是当我添加它时得到错误消息。命令是:mvn package

错误日志是:

[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ sensitivity ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/dainping/Documents/GitCode/sensitivity/src/main/resources
[INFO] 
[INFO] --- maven-scala-plugin:2.15.2:compile (default) @ sensitivity ---
[INFO] Checking for multiple versions of scala
[INFO] artifact com.google.guava:guava: checking for updates from meituan-dianping
[WARNING]  Expected all dependencies to require Scala version: 2.11.8
[WARNING]  org.json4s:json4s-core_2.11:3.2.11 requires scala version: 2.11.0
[WARNING] Multiple versions of scala libraries detected!
[INFO] includes = [**/*.java,**/*.scala,]
[INFO] excludes = []
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ sensitivity ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default) @ sensitivity ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-scala-plugin:2.15.2:compile (compile) @ sensitivity ---
[INFO] Checking for multiple versions of scala
[INFO] artifact com.google.guava:guava: checking for updates from meituan-dianping
[WARNING]  Expected all dependencies to require Scala version: 2.11.8
[WARNING]  org.json4s:json4s-core_2.11:3.2.11 requires scala version: 2.11.0
[WARNING] Multiple versions of scala libraries detected!
[INFO] includes = [**/*.java,**/*.scala,]
[INFO] excludes = []
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- scala-maven-plugin:3.2.1:compile (default) @ sensitivity ---
[INFO] artifact com.google.guava:guava: checking for updates from meituan-dianping
[WARNING]  Expected all dependencies to require Scala version: 2.11.8
[WARNING]  org.json4s:json4s-core_2.11:3.2.11 requires scala version: 2.11.0
[WARNING] Multiple versions of scala libraries detected!
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ sensitivity ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/dainping/Documents/GitCode/sensitivity/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ sensitivity ---
[INFO] Nothing to compile - all classes are up to date
[INFO] 
[INFO] --- maven-scala-plugin:2.15.2:testCompile (test-compile) @ sensitivity ---
[INFO] Checking for multiple versions of scala
[INFO] artifact com.google.guava:guava: checking for updates from meituan-dianping
[WARNING]  Expected all dependencies to require Scala version: 2.11.8
[WARNING]  org.json4s:json4s-core_2.11:3.2.11 requires scala version: 2.11.0
[WARNING] Multiple versions of scala libraries detected!
[INFO] includes = [**/*.java,**/*.scala,]
[INFO] excludes = []
[WARNING] No source files found.
[INFO] 
[INFO] --- scala-maven-plugin:3.2.1:testCompile (default) @ sensitivity ---
[INFO] artifact com.google.guava:guava: checking for updates from meituan-dianping
[WARNING]  Expected all dependencies to require Scala version: 2.11.8
[WARNING]  org.json4s:json4s-core_2.11:3.2.11 requires scala version: 2.11.0
[WARNING] Multiple versions of scala libraries detected!
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ sensitivity ---
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ sensitivity ---
[INFO] 
[INFO] --- maven-assembly-plugin:2.5:single (make-assembly) @ sensitivity ---
[INFO] artifact com.google.guava:guava: checking for updates from meituan-dianping
[INFO] Building jar: /Users/dainping/Documents/GitCode/sensitivity/target/sensitivity-1.0-SNAPSHOT-jar-with-dependencies.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 11.760 s
[INFO] Finished at: 2018-05-15T19:46:05+08:00
[INFO] Final Memory: 67M/660M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.5:single (make-assembly) on project sensitivity: Execution make-assembly of goal org.apache.maven.plugins:maven-assembly-plugin:2.5:single failed.: NullPointerException -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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/PluginExecutionException

有人知道我的情况哪里错了吗?

PS:在别人的电脑上也能正常使用。

标签: scalamavenapache-spark

解决方案


推荐阅读