简体   繁体   English

如何通过xsbt-web-plugin / merge application.conf包含每个Project Jar文件?

[英]How to include per Project Jar file with xsbt-web-plugin / merge application.conf?

I just switched from maven to sbt for a Scala build. 我只是从Maven切换到sbt进行Scala构建。 Since part of the builds are also war files, I use xsbt-web-plugin to create war files with sbt. 由于构建的一部分也是war文件,因此我使用xsbt-web-plugin创建带有sbt的war文件。 Everything works fine, except an issue with the outputted WAR. 一切正常,除了输出的WAR的问题。

The WAR dependsOn two other sub projects (transitively). WAR dependsOn其他两个子项目(可传递)。 When I run package the classes and resources of the other sub projects are both merged and copied. 当我运行包时,其他子项目的类和资源都将合并并复制。 Which also means that the application.conf is overwritten by the most recently defined dependsOn and not merged. 这也意味着application.conf被最新定义的dependsOn覆盖,并且不被合并。

How this is solved by maven is that it includes every dependency as a JAR file in the WEB-INF/lib , however this is due to that maven has no mechanism like dependsOn vs libraryDependencies . maven如何解决此问题,因为它在WEB-INF/lib中将每个依赖项都包含为JAR文件,但这是由于maven没有像dependsOn vs libraryDependencies这样的机制。

How can this be solved with xsbt-web-plugin? 如何使用xsbt-web-plugin解决此问题? By using a merge strategy like OneJar or do I have to split the WAR build from the other build and define them as dependencies. 通过使用像OneJar这样的合并策略,还是必须将WAR构建与其他构建分开,并将它们定义为依赖项。

OK, figured it out with some more searching, https://github.com/earldouglas/xsbt-web-plugin/issues/111 gave the right hint. 好的,通过更多搜索找到答案, https://github.com/earldouglas/xsbt-web-plugin/issues/111提供了正确的提示。

Set exportJars := true for the dependsOn modules. dependsOn模块设置exportJars := true

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM