英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论