maven打包報錯:在類路徑或引導類路徑中找不到程式包 java.lang

weixin_30924079發表於2020-04-04

  剛下了個新專案,跑了下maven報錯了:

E:\workspace\portalframe>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:\workspace\portalframe\target
[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:\workspace\portalframe\target\classes
致命錯誤: 在類路徑或引導類路徑中找不到程式包 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,這次不再出現該問題了。

轉載於:https://www.cnblogs.com/wuxun1997/p/10318817.html

相關文章