Scala构建工具(sbt)和像IntelliJ这样的工件

huangapple go评论54阅读模式
英文:

scala build tools (sbt) and artefacts like intelliJ

问题

我正在尝试使用sbt创建一个Java构件,在IntelliJ IDEA中,你可以在菜单中找到此选项,并且可以轻松创建构件并将任意文件添加到该构件中。

问题是,你如何在sbt命令行中执行此操作?

我想要做的是创建一个简单的已编译Java构件(使用Scala语言),并在其中添加一个任意文件,这样做的原因是这个JAR将被某个其他工具使用,该工具期望在JAR(构件)中存在一个 .yml 文件。

感谢帮助!

英文:

I am trying to create a Java artefact with sbt, in IntelliJ IDEA you have this option in the menu and you can easily create artifects and add arbitrary files to said artefacts.

The question is, how could you do this in sbt commandline?

What I want to do is, create a simple compiled java artifact (using the scala language that is), and also add an arbitrary file to it, the reason for this is that this jar will be used by some other tool which expects a .yml file to be present within the jar (artifact).

Thanks for the help!

答案1

得分: 2

尝试将文件(.yml)放入 src/main/resources 并执行 sbt package

target/scala-2.1x 目录中,您会找到一个包含该文件的 JAR 文件。

https://www.scala-sbt.org/1.x/docs/Howto-Package.html

英文:

Try to put the file (.yml) into src/main/resources and do sbt package.

In target/scala-2.1x you'll find a jar with the file in the root.

https://www.scala-sbt.org/1.x/docs/Howto-Package.html

huangapple
  • 本文由 发表于 2023年3月3日 22:23:41
  • 转载请务必保留本文链接:https://go.coder-hub.com/75628269.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定