[ERROR] Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.2.2:compile (default) on proj

25 篇文章 0 订阅

maven编译异常错误loading CharSequence class file is broken

标签: maven broken
1292人阅读  评论(0)  收藏  举报
  分类:
java/scala(5) 

  在用maven对项目进行编译打包时,遇到了下面奇怪的编译错误

[plain]  view plain  copy
  1. "C:\Program Files\Java\jdk1.8.0\bin\java" "-Dmaven.home=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.2.1\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.2.1\plugins\maven\lib\maven3\bin\m2.conf" -Didea.launcher.port=7532 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.2.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.2.1\plugins\maven\lib\maven3\boot\plexus-classworlds-2.4.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.2.1\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=2016.2.1 -s D:\apache-maven-3.2.5\conf\settings.xml package  
  2. [INFO] Scanning for projects...  
  3. [WARNING]   
  4. [WARNING] Some problems were encountered while building the effective model for com.fangdd.data:house-profile:jar:1.0-SNAPSHOT  
  5. [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-install-plugin is missing. @ line 181, column 21  
  6. [WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-deploy-plugin is missing. @ line 173, column 21  
  7. [WARNING]   
  8. [WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.  
  9. [WARNING]   
  10. [WARNING] For this reason, future Maven versions might no longer support building such malformed projects.  
  11. [WARNING]   
  12. [INFO]                                                                           
  13. [INFO] ------------------------------------------------------------------------  
  14. [INFO] Building house-profile 1.0-SNAPSHOT  
  15. [INFO] ------------------------------------------------------------------------  
  16. [INFO]   
  17. [INFO] --- maven-enforcer-plugin:1.4.1:enforce (enforce) @ house-profile ---  
  18. [INFO]   
  19. [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ house-profile ---  
  20. [debug] execute contextualize  
  21. [INFO] Using 'UTF-8' encoding to copy filtered resources.  
  22. [INFO] skip non existing resourceDirectory D:\git-repository\house-profile\src\main\resources\prod  
  23. [INFO] Copying 4 resources  
  24. [INFO]   
  25. [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ house-profile ---  
  26. [INFO] Nothing to compile - all classes are up to date  
  27. [INFO]   
  28. [INFO] --- scala-maven-plugin:3.2.2:compile (default) @ house-profile ---  
  29. [WARNING]  Expected all dependencies to require Scala version: 2.10.0  
  30. [WARNING]  com.twitter:chill_2.10:0.5.0 requires scala version: 2.10.4  
  31. [WARNING] Multiple versions of scala libraries detected!  
  32. [INFO] D:\git-repository\house-profile\src\main\java:-1: info: compiling  
  33. [INFO] D:\git-repository\house-profile\src\main\scala:-1: info: compiling  
  34. [INFO] Compiling 27 source files to D:\git-repository\house-profile\target\classes at 1498550091810  
  35. [ERROR] error: error while loading CharSequence, class file 'C:\Program Files\Java\jdk1.8.0\jre\lib\rt.jar(java/lang/CharSequence.class)' is broken  
  36. [INFO] (class java.lang.RuntimeException/bad constant pool tag 15 at byte 1501)  
  37. [ERROR] error: error while loading AnnotatedElement, class file 'C:\Program Files\Java\jdk1.8.0\jre\lib\rt.jar(java/lang/reflect/AnnotatedElement.class)' is broken  
  38. [INFO] (class java.lang.RuntimeException/bad constant pool tag 15 at byte 2713)  
  39. [ERROR] error: error while loading ConcurrentMap, class file 'C:\Program Files\Java\jdk1.8.0\jre\lib\rt.jar(java/util/concurrent/ConcurrentMap.class)' is broken  
  40. [INFO] (class java.lang.RuntimeException/bad constant pool tag 15 at byte 2447)  
  41. [ERROR] D:\git-repository\house-profile\src\main\scala\com\fangdd\data\profile\processor\ItemAddressProcessor.scala:21: error: overloaded method value replaceAllIn with alternatives:  
  42. [ERROR]   (target: CharSequence,replacer: scala.util.matching.Regex.Match => String)String <and>  
  43. [ERROR]   (target: CharSequence,replacement: String)String  
  44. [ERROR]  cannot be applied to (String, String)  
  45. [ERROR]       val addressReg = Constants.SPECIAL_CHAR_REG.r.replaceAllIn(address, "")  
  46. [ERROR]                                                     ^  
  47. [ERROR] D:\git-repository\house-profile\src\main\scala\com\fangdd\data\profile\processor\ItemNameProcessor.scala:24: error: type mismatch;  
  48. [ERROR]  found   : String  
  49. [ERROR]  required: CharSequence  
  50. [ERROR]       if (StringUtils.isNotBlank(name)) {  
  51. [ERROR]                                  ^  
  52. [ERROR] D:\git-repository\house-profile\src\main\scala\com\fangdd\data\profile\processor\ItemNameProcessor.scala:44: error: type mismatch;  
  53. [ERROR]  found   : String  
  54. [ERROR]  required: CharSequence  
  55. [ERROR]       if (StringUtils.isNotBlank(name)) {  
  56. [ERROR]                                  ^  
  57. [ERROR] D:\git-repository\house-profile\src\main\scala\com\fangdd\data\profile\processor\ItemNameProcessor.scala:55: error: overloaded method value indexOf with alternatives:  
  58. [ERROR]   (CharSequence,CharSequence)Int <and>  
  59. [ERROR]   (CharSequence,Int)Int  
  60. [ERROR]  cannot be applied to (String, String)  
  61. [ERROR]          val baseName = StringUtils.substring(tmp1, 0, StringUtils.indexOf(tmp1, ""))  
  62. [ERROR]                                                                    ^  
  63. [ERROR] error: error while loading Pattern, class file 'C:\Program Files\Java\jdk1.8.0\jre\lib\rt.jar(java/util/regex/Pattern.class)' is broken  
  64. [INFO] (class java.lang.RuntimeException/bad constant pool tag 15 at byte 14717)  
  65. [ERROR] D:\git-repository\house-profile\src\main\scala\com\fangdd\data\profile\processor\ItemNameProcessor.scala:127: error: type mismatch;  
  66. [ERROR]  found   : String  
  67. [ERROR]  required: CharSequence  
  68. [ERROR]             if (StringUtils.equals(srcNameNormalized, tgtNameNormalized)) {  
  69. [ERROR]                                    ^  
  70. [ERROR] D:\git-repository\house-profile\src\main\scala\com\fangdd\data\profile\util\ItemAddressProcessor.scala:22: error: overloaded method value replaceAllIn with alternatives:  
  71. [ERROR]   (target: CharSequence,replacer: scala.util.matching.Regex.Match => String)String <and>  
  72. [ERROR]   (target: CharSequence,replacement: String)String  
  73. [ERROR]  cannot be applied to (String, String)  
  74. [ERROR]       val addressReg = Constants.SPECIAL_CHAR_REG.r.replaceAllIn(address, "")  
  75. [ERROR]                                                     ^  
  76. [ERROR] 10 errors found  
  77. [INFO] ------------------------------------------------------------------------  
  78. [INFO] BUILD FAILURE  
  79. [INFO] ------------------------------------------------------------------------  
  80. [INFO] Total time: 7.241s  
  81. [INFO] Finished at: Tue Jun 27 15:54:55 CST 2017  
  82. [INFO] Final Memory: 19M/259M  
  83. [INFO] ------------------------------------------------------------------------  
  84. [ERROR] Failed to execute goal net.alchim31.maven:scala-maven-plugin:3.2.2:compile (default) on project house-profile: wrap: org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [Help 1]  
  85. [ERROR]   
  86. [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.  
  87. [ERROR] Re-run Maven using the -X switch to enable full debug logging.  
  88. [ERROR]   
  89. [ERROR] For more information about the errors and possible solutions, please read the following articles:  
  90. [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException  
  91.   
  92. Process finished with exit code 1  

最后发现是maven编译插件配置的原因,编译插件版本不完整配置的是scala.binary.version,应该采用完整版本scala.complete.version才能找到具体的class

[html]  view plain  copy
  1.  <properties>  
  2.         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>  
  3.         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>  
  4.         <java.version>1.8</java.version>  
  5.         <maven.version.min>3.0.5</maven.version.min>  
  6.         <scala.binary.version>2.11</scala.binary.version>  
  7.         <scala.complete.version>${scala.binary.version}.4</scala.complete.version>  
  8.         <spark.version>1.6.2</spark.version>  
  9.         <spark-sql.version>1.6.2</spark-sql.version>  
  10.         <spark-hive.version>1.6.2</spark-hive.version>  
  11.  </properties>  
  12.   
  13. <plugin>  
  14.     <groupId>net.alchim31.maven</groupId>  
  15.     <artifactId>scala-maven-plugin</artifactId>  
  16.     <version>3.2.2</version>  
  17.     <configuration>  
  18.         <scalaVersion>${scala.complete.version}</scalaVersion>  
  19.         <args>  
  20.             <arg>-unchecked</arg>  
  21.             <arg>-deprecation</arg>  
  22.             <arg>-feature</arg>  
  23.         </args>  
  24.         <javacArgs>  
  25.             <javacArg>-source</javacArg>  
  26.             <javacArg>${java.version}</javacArg>  
  27.             <javacArg>-target</javacArg>  
  28.             <javacArg>${java.version}</javacArg>  
  29.         </javacArgs>  
  30.     </configuration>  
  31.     <executions>  
  32.         <execution>  
  33.             <phase>compile</phase>  
  34.             <goals>  
  35.                 <goal>compile</goal>  
  36.             </goals>  
  37.         </execution>  
  38.     </executions>  
  39. </plugin>  
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值