maven打包报错:在类路径或引导类路径中找不到程序包 java.lang

Posted 不想下火车的人

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了maven打包报错:在类路径或引导类路径中找不到程序包 java.lang相关的知识,希望对你有一定的参考价值。

  刚下了个新项目,跑了下maven报错了:

E:workspaceportalframe>mvn clean install
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.migu.reading.portalFrame:ues:war:trunk-SNAPSHOT
[WARNING] dependencies.dependency.(groupId:artifactId:type:classifier) must be unique: com.portalFrame:commons.mq:jar -> duplicate declaration of version V300R003C20B311 @ line 1031, column 17
[WARNING] dependencies.dependency.(groupId:artifactId:type:classifier) must be unique: com.portalFrame:axis:jar -> version 0.0.1 vs 1.4 @ line 1164, column 17
[WARNING] dependencies.dependency.(groupId:artifactId:type:classifier) must be unique: com.portalFrame:com.huawei.uxe.core.render:jar -> version 3.2.21.22 vs 0.0.1 @ line 1230, column 17
[WARNING] dependencies.dependency.(groupId:artifactId:type:classifier) must be unique: com.portalFrame:commons-codec:jar -> duplicate declaration of version 1.3.2 @ line 1483, column 17
[WARNING] dependencies.dependency.(groupId:artifactId:type:classifier) must be unique: com.portalFrame:jdom:jar -> version 1.1 vs 0.0.1 @ line 1982, column 17
[WARNING] build.plugins.plugin.version for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 2915, column 15
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building ues trunk-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ ues ---
[INFO] Deleting E:workspaceportalframe	arget
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ ues ---
[INFO] Using UTF-8 encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] Copying 352 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ ues ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4791 source files to E:workspaceportalframe	argetclasses
致命错误: 在类路径或引导类路径中找不到程序包 java.lang
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] An unknown compilation problem occurred
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.730 s
[INFO] Finished at: 2019-01-25T11:37:58+08:00
[INFO] Final Memory: 40M/637M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project ues: Compilation failure
[ERROR] An unknown compilation problem occurred
[ERROR] -> [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/MojoFailureException

  既然是编译错误,那么就考虑下jdk包问题,去看了下pom.xml,发现插件里有这个东西:

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
          <encoding>UTF-8</encoding>
          <optimize>false</optimize>
          <debug>false</debug>
          <showDeprecation>false</showDeprecation>
          <showWarnings>true</showWarnings>
          <compilerArguments>
           <bootclasspath>${java.home}/lib/rt.jar:${java.home}/lib/jce.jar</bootclasspath>
          </compilerArguments>
        </configuration>
      </plugin>

  看到bootclasspath就觉得很奇怪,为啥是个冒号来分割呢?一查才知道,冒号是用于linux操作系统的,windows下只能改为分号。改完重新跑maven,这次不再出现该问题了。

以上是关于maven打包报错:在类路径或引导类路径中找不到程序包 java.lang的主要内容,如果未能解决你的问题,请参考以下文章

错误:org.testng.TestNGException:在类路径中找不到类:EmpClass

Spring boot graphql 在类路径中找不到 graphql 模式文件

使用启用了安全管理器的 Tomcat 时,在类路径中找不到属性文件

TestNG 错误在类路径中找不到类

在类路径中找不到休眠验证器

Atlassian Bamboo Logs:[testng] 在类路径中找不到类:com.vaannila.domain.UserTest