IntelliJ:命令行太长.缩短SBT项目中...的命令行 [英] IntelliJ: Command Line is too Long. Shorten command line for... in SBT project

查看:522
本文介绍了IntelliJ:命令行太长.缩短SBT项目中...的命令行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试运行我的应用程序时,IntelliJ才开始告诉我

When I try to run my app, IntelliJ has just started to tell me

命令行太长.请缩短my_app或应用程序默认配置的命令行."

"Command Line is too Long. Shorten command line for my_app or also for Application default configuration."

my_app是一个蓝色链接,它指向一个编辑配置"窗口,该窗口自动选择并突出显示用于类路径缩短器的下拉菜单.我选择了建议的选项,但没有更改.

the my_app is a blue link which leads to an "Edit Configuration" window, automatically selecting and highlighting a dropdown for class path shortener. I select the suggested options, but no change.

我不知道这意味着什么-我正在使用Scala,所以我正在使用一个简单的object MyObj extends App,它根本没有任何参数.

I have no idea what this means - I'm using Scala, so I'm using a simple object MyObj extends App which takes no parameters at all.

我尝试按照其他类似问题的建议将<property name="dynamic.classpath" value="true" />添加到workspace.xml,但无济于事.

I have tried adding <property name="dynamic.classpath" value="true" /> to the workspace.xml as suggested by other similar questions, but to no avail.

我以前曾经能够在我的项目中很好地运行程序.但是什么加长了命令行呢?命令行上到底放了什么?

I used to be able to run my programs in my project fine before. But what lengthens a command line? What is being put on the command line at all?

推荐答案

找到了修复程序,这是SBT特定的.我相信正在发生的事情是libaryDependencies一个放在他们的build.sbt文件中,实际上将所有依赖项的jar添加到了用于运行程序的类路径中.

Found the fix, this is SBT specific. I believe what is happening is that the libaryDependencies one puts in their build.sbt file actually adds all the jars of those dependencies to the classpath used to run your program.

要解决此问题,只需添加

To fix this, simply add

lazy val scriptClasspath = Seq("*") (lazy可能是可选的)

至您的build.sbt文件.我将

  • 与库相关性放在root val之上.不确定是否有必要,但是如果遇到问题

    to your build.sbt file. I placed mine above the root val with the library dependencies. Not sure if that's necessary, but shift it around if you're having trouble

    这是在运行程序时,SBT将把这些jar构建的长"类路径浓缩到自己的jar中,然后运行该jar,这将启动您的所有依赖关系和程序.

    What this does, is upon running the program SBT will condense the "long" classpath built by those jars into a jar of its own, and just run that jar, which will kick off all of your dependencies and program.

    检查进行更长的演示以及其他答案

    Check this out for the longer demonstration, as well as other answers

    这篇关于IntelliJ:命令行太长.缩短SBT项目中...的命令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆