sbt打包遇到的一些问题。【Couldn‘t retrieve source module: org.scala-sbt:compiler-interface:0.13.11:component】

查看sbt是否安装成功或打包的时候出现以下报错:

[ERROR] Failed to construct terminal; falling back to unsupported
java.lang.NumberFormatException: For input string: "0x100"
    at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.lang.Integer.parseInt(Integer.java:580)
    at java.lang.Integer.valueOf(Integer.java:766)
    at jline.internal.InfoCmp.parseInfoCmp(InfoCmp.java:59)
    at jline.UnixTerminal.parseInfoCmp(UnixTerminal.java:233)
    at jline.UnixTerminal.<init>(UnixTerminal.java:64)
    at jline.UnixTerminal.<init>(UnixTerminal.java:49)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.lang.Class.newInstance(Class.java:442)
    at jline.TerminalFactory.getFlavor(TerminalFactory.java:209)
    at jline.TerminalFactory.create(TerminalFactory.java:100)
    at jline.TerminalFactory.get(TerminalFactory.java:184)
    at jline.TerminalFactory.get(TerminalFactory.java:190)
    at sbt.ConsoleLogger$.ansiSupported(ConsoleLogger.scala:123)
    at sbt.ConsoleLogger$.<init>(ConsoleLogger.scala:117)
    at sbt.ConsoleLogger$.<clinit>(ConsoleLogger.scala)
    at sbt.GlobalLogging$.initial(GlobalLogging.scala:43)
    at sbt.StandardMain$.initialGlobalLogging(Main.scala:61)
    at sbt.StandardMain$.initialState(Main.scala:70)
    at sbt.xMain.run(Main.scala:29)
    at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
    at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
    at xsbt.boot.Launch$.run(Launch.scala:109)
    at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
    at xsbt.boot.Launch$.launch(Launch.scala:117)
    at xsbt.boot.Launch$.apply(Launch.scala:18)
    at xsbt.boot.Boot$.runImpl(Boot.scala:41)
    at xsbt.boot.Boot$.main(Boot.scala:17)
    at xsbt.boot.Boot.main(Boot.scala)

实测有效方法!

在~/.bashrc中加入export TERM=xterm-color,保存后再次运行查看。

我第一次试了之后没成功,重启之后就可以了,有点玄学吧。

sudo vim ~/.bashrc
#添加
export TERM=xterm-color
#保存
source ~/.bashrc

用sbt打包的时候也遇到了这个问题,在网上找了好久。。。

最后死马当活马医,试了简单的代码去打包后,发现可以了!

参天啊!!!

居然是原本我要打包的代码里面出现了错误😭

momo@momo:~/sparkapp$ /usr/local/sbt/sbt package
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed in 8.0
[info] Set current project to Simple Project (in build file:/home/momo/sparkapp/)
[info] Compiling 1 Scala source to /home/momo/sparkapp/target/scala-2.11/classes...
[info] Attempting to fetch org.scala-sbt % compiler-interface % 0.13.11. This operation may fail.
[info] Resolving org.scala-sbt#interface;0.13.11 ...
[warn]     [FAILED     ] org.scala-sbt#compiler-interface;0.13.11!compiler-interface.jar(src):  (0ms)
[warn] ==== local: tried
[warn]   /home/momo/.ivy2/local/org.scala-sbt/compiler-interface/0.13.11/srcs/compiler-interface-sources.jar
[warn] ==== huaweicloud-maven: tried
[warn]   https://repo.huaweicloud.com/repository/maven/org/scala-sbt/compiler-interface/0.13.11/compiler-interface-0.13.11-sources.jar
[warn] ==== maven-central: tried
[warn]   https://repo1.maven.org/maven2/org/scala-sbt/compiler-interface/0.13.11/compiler-interface-0.13.11-sources.jar
[warn] ==== sbt-plugin-repo: tried
[warn]   https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.scala-sbt/compiler-interface/0.13.11/srcs/compiler-interface-sources.jar
[warn]     ::::::::::::::::::::::::::::::::::::::::::::::
[warn]     ::              FAILED DOWNLOADS            ::
[warn]     :: ^ see resolution messages for details  ^ ::
[warn]     ::::::::::::::::::::::::::::::::::::::::::::::
[warn]     :: org.scala-sbt#compiler-interface;0.13.11!compiler-interface.jar(src)
[warn]     ::::::::::::::::::::::::::::::::::::::::::::::
sbt.InvalidComponent: Couldn't retrieve source module: org.scala-sbt:compiler-interface:0.13.11:component
    at sbt.compiler.IvyComponentCompiler$$anonfun$sbt$compiler$IvyComponentCompiler$$compileAndInstall$1$$anonfun$apply$2$$anonfun$apply$mcV$sp$1.apply(ComponentCompiler.scala:124)
    at sbt.compiler.IvyComponentCompiler$$anonfun$sbt$compiler$IvyComponentCompiler$$compileAndInstall$1$$anonfun$apply$2$$anonfun$apply$mcV$sp$1.apply(ComponentCompiler.scala:117)
    at sbt.IO$.withTemporaryDirectory(IO.scala:344)
    at sbt.compiler.IvyComponentCompiler$$anonfun$sbt$compiler$IvyComponentCompiler$$compileAndInstall$1$$anonfun$apply$2.apply$mcV$sp(ComponentCompiler.scala:117)
    at sbt.compiler.IvyComponentCompiler$$anonfun$sbt$compiler$IvyComponentCompiler$$compileAndInstall$1$$anonfun$apply$2.apply(ComponentCompiler.scala:117)
    at sbt.compiler.IvyComponentCompiler$$anonfun$sbt$compiler$IvyComponentCompiler$$compileAndInstall$1$$anonfun$apply$2.apply(ComponentCompiler.scala:117)
    at sbt.BufferedLogger.bufferQuietly(BufferedLogger.scala:31)
    at sbt.compiler.IvyComponentCompiler$$anonfun$sbt$compiler$IvyComponentCompiler$$compileAndInstall$1.apply(ComponentCompiler.scala:115)
    at sbt.compiler.IvyComponentCompiler$$anonfun$sbt$compiler$IvyComponentCompiler$$compileAndInstall$1.apply(ComponentCompiler.scala:110)
    at sbt.IO$.withTemporaryDirectory(IO.scala:344)
    at sbt.compiler.IvyComponentCompiler.sbt$compiler$IvyComponentCompiler$$compileAndInstall(ComponentCompiler.scala:110)
    at sbt.compiler.IvyComponentCompiler$$anonfun$apply$1.apply$mcV$sp(ComponentCompiler.scala:101)
    at sbt.IfMissing$Define.apply(ComponentManager.scala:75)
    at sbt.ComponentManager.sbt$ComponentManager$$createAndCache$1(ComponentManager.scala:39)
    at sbt.ComponentManager$$anonfun$sbt$ComponentManager$$fromGlobal$1$1.apply(ComponentManager.scala:27)
    at sbt.ComponentManager$$anonfun$sbt$ComponentManager$$fromGlobal$1$1.apply(ComponentManager.scala:26)
    at sbt.ComponentManager$$anon$1.call(ComponentManager.scala:50)
    at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:93)
    at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:78)
    at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:97)
    at xsbt.boot.Using$.withResource(Using.scala:10)
    at xsbt.boot.Using$.apply(Using.scala:9)
    at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:58)
    at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:48)
    at xsbt.boot.Locks$.apply0(Locks.scala:31)
    at xsbt.boot.Locks$.apply(Locks.scala:28)
    at sbt.ComponentManager.lock(ComponentManager.scala:50)
    at sbt.ComponentManager.lockGlobalCache(ComponentManager.scala:49)
    at sbt.ComponentManager.sbt$ComponentManager$$fromGlobal$1(ComponentManager.scala:25)
    at sbt.ComponentManager$$anonfun$files$1$$anonfun$apply$2.apply(ComponentManager.scala:44)
    at sbt.ComponentManager$$anonfun$files$1$$anonfun$apply$2.apply(ComponentManager.scala:44)
    at sbt.ComponentManager.sbt$ComponentManager$$getOrElse$1(ComponentManager.scala:32)
    at sbt.ComponentManager$$anonfun$files$1.apply(ComponentManager.scala:44)
    at sbt.ComponentManager$$anonfun$files$1.apply(ComponentManager.scala:44)
    at sbt.ComponentManager$$anon$1.call(ComponentManager.scala:50)
    at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:93)
    at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:78)
    at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:97)
    at xsbt.boot.Using$.withResource(Using.scala:10)
    at xsbt.boot.Using$.apply(Using.scala:9)
    at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:58)
    at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:48)
    at xsbt.boot.Locks$.apply0(Locks.scala:31)
    at xsbt.boot.Locks$.apply(Locks.scala:28)
    at sbt.ComponentManager.lock(ComponentManager.scala:50)
    at sbt.ComponentManager.lockLocalCache(ComponentManager.scala:47)
    at sbt.ComponentManager.files(ComponentManager.scala:44)
    at sbt.ComponentManager.file(ComponentManager.scala:53)
    at sbt.compiler.IvyComponentCompiler.apply(ComponentCompiler.scala:101)
    at sbt.compiler.ComponentCompiler$$anon$2.apply(ComponentCompiler.scala:35)
    at sbt.compiler.AnalyzingCompiler.loader(AnalyzingCompiler.scala:112)
    at sbt.compiler.AnalyzingCompiler.getInterfaceClass(AnalyzingCompiler.scala:117)
    at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:98)
    at sbt.compiler.AnalyzingCompiler.newCachedCompiler(AnalyzingCompiler.scala:56)
    at sbt.compiler.AnalyzingCompiler.newCachedCompiler(AnalyzingCompiler.scala:51)
    at sbt.compiler.CompilerCache$$anon$2.apply(CompilerCache.scala:47)
    at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:39)
    at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply$mcV$sp(MixedAnalyzingCompiler.scala:50)
    at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply(MixedAnalyzingCompiler.scala:50)
    at sbt.compiler.MixedAnalyzingCompiler$$anonfun$compileScala$1$1.apply(MixedAnalyzingCompiler.scala:50)
    at sbt.compiler.MixedAnalyzingCompiler.timed(MixedAnalyzingCompiler.scala:74)
    at sbt.compiler.MixedAnalyzingCompiler.compileScala$1(MixedAnalyzingCompiler.scala:49)
    at sbt.compiler.MixedAnalyzingCompiler.compile(MixedAnalyzingCompiler.scala:64)
    at sbt.compiler.IC$$anonfun$compileInternal$1.apply(IncrementalCompiler.scala:160)
    at sbt.compiler.IC$$anonfun$compileInternal$1.apply(IncrementalCompiler.scala:160)
    at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:66)
    at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:64)
    at sbt.inc.IncrementalCommon.cycle(IncrementalCommon.scala:32)
    at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:68)
    at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:67)
    at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:95)
    at sbt.inc.Incremental$.compile(Incremental.scala:67)
    at sbt.inc.IncrementalCompile$.apply(Compile.scala:54)
    at sbt.compiler.IC$.compileInternal(IncrementalCompiler.scala:160)
    at sbt.compiler.IC$.incrementalCompile(IncrementalCompiler.scala:138)
    at sbt.Compiler$.compile(Compiler.scala:152)
    at sbt.Compiler$.compile(Compiler.scala:138)
    at sbt.Defaults$.sbt$Defaults$$compileIncrementalTaskImpl(Defaults.scala:860)
    at sbt.Defaults$$anonfun$compileIncrementalTask$1.apply(Defaults.scala:851)
    at sbt.Defaults$$anonfun$compileIncrementalTask$1.apply(Defaults.scala:849)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
    at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:40)
    at sbt.std.Transform$$anon$4.work(System.scala:63)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:228)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
    at sbt.Execute.work(Execute.scala:237)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:228)
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:159)
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:28)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
[error] (compile:compileIncremental) sbt.InvalidComponent: Couldn't retrieve source module: org.scala-sbt:compiler-interface:0.13.11:component
[error] Total time: 15 s, completed 2023-3-4 17:42:45

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值