商品在单个任务的多模块构建中

商品在单个任务的多模块构建中

本文介绍了如何“包装"商品在单个任务的多模块构建中,一些模块会引起jar的冲突,而其他模块会引发战争?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我使用package任务(来自 xsbt-web-plugin )进行打包一个战争项目,并执行assembly任务(来自 sbt-assembly )来打包该项目到一个罐子里.

I use package task (from xsbt-web-plugin) to package a project to a war, and assembly task (from sbt-assembly) to package the project to a jar.

我有一个多模块构建,有的模块打包成war,有的打包成jar.

I have a multi-module build and some modules are packaged into wars and some into jars.

我想设置构建以执行assembly任务,并且:

I'd like to set up the build to execute assembly task and:

  • Jar模块打包到jar文件中
  • 战争模块打包到战争文件中

在执行assembly任务时如何为战争项目执行package任务?

How to execute package task for the war projects while executing assembly task?

推荐答案

package任务和assembly任务都评估为File类型,因此@James评论说,您应该能够在assembly任务中重新布线assembly任务. webapp项目改为运行package.

Both package task and assembly task evaluate to File type, so as @James commented you should be able to rewire assembly task in webapp project to run package instead.

lazy val commonSettings = Seq(
  scalaVersion := "2.11.4"
)
lazy val webappAssembly = Seq(
  assembly := packageWar.value
)

lazy val root = (project in file(".")).
  aggregate(app, webapp).
  settings(commonSettings: _*)

lazy val app = (project in file("app")).
  settings(commonSettings: _*)

lazy val webapp = (project in file("webapp")).
  settings(commonSettings ++ jetty() ++ webappAssembly: _*).
  settings(
    libraryDependencies += "javax.servlet" % "javax.servlet-api" % "3.0.1" % "provided"
  )

这篇关于如何“包装"商品在单个任务的多模块构建中,一些模块会引起jar的冲突,而其他模块会引发战争?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 21:52