如何使用 scala sbt 构建多个 jar 文件
在我的项目中,我有以下结构:
源文件/
插件/
<块引用>\__ mpc
|__ 操作
我将 src 中的所有 scala 文件编译成一个 jar (主程序),然后 plugins 中的每个子目录都包含 scala 文件,这些文件应该构建一个由主程序加载的插件 jar (所以一个 jar用于插件/mpc,另一个用于插件/操作)。
在根目录中我有一个 build.sbt:
名称:=“mrtoms”
组织:=“chilon”
版本:=“0.1”
libraryDependency ++= Seq("commons-httpclient" % "commons-httpclient" % "3.1")
交叉路径:= false
scalaHome := Some(file("/usr/share/scala"))
目标:=文件(“项目/目标”)
编译中的scalaSource <<= baseDirectory(_ / "src")
mainClass := Some("org.chilon.mrtoms.MrToms")
从 src 中的文件构建我的主 jar 文件就好了..如何为每个插件中的源文件添加 jar目录?
In my project I have the following structure:
src/
plugins/
\__ mpc
|__ oper
I compile all of the scala files in src into a single jar (the main program), then each subdirectory in plugins contains scala files that should build a plugin jar to be loaded by the main program (so one jar for plugins/mpc and another for plugins/oper).
In the root I have a build.sbt:
name := "mrtoms"
organization := "chilon"
version := "0.1"
libraryDependencies ++= Seq("commons-httpclient" % "commons-httpclient" % "3.1")
crossPaths := false
scalaHome := Some(file("/usr/share/scala"))
target := file("project/target")
scalaSource in Compile <<= baseDirectory(_ / "src")
mainClass := Some("org.chilon.mrtoms.MrToms")
That builds my main jar file from the files in src just fine.. how do I add jars for the sources file in each plugin directory?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
似乎您需要完整配置(目前您正在使用基本配置):
https://github.com/harrah /xsbt/wiki/Full-Configuration
在您的情况下,
root
项目是您的主 jar。每个插件应该有它自己的项目,即根项目聚合。完整的配置可以是这样的:Seems that you need full configuration (at the moment you are using basic one):
https://github.com/harrah/xsbt/wiki/Full-Configuration
In your case,
root
project is your main jar. Each plugin should then have it's own project, that root project aggregates. Full configuration can be something like this: