我使用sbtosgi插件来使用bnd从sbt构建生成一个OSGi包。sbtosgi包提供了生成包的osgi任务。使用sbtosgi的默认配置,从sbt提示符中运行OSGi将更新JAR以包含适当的头,但是运行干净的包会导致JAR没有OSGi头。在Maven中,我试图使用maven- bundle -plugin进行打包= bundle --也就是说,项目的主要工件应该是OSGi包。
基于读取sbtosgi插件的源代码,在我看来,osgi任务覆盖了packageBin创建的JAR。我试图重写packageBin的定义,以便它使用osgi任务而不是默认任务:
packageBin in Compile <<= OsgiKeys.bundle但是,这导致了循环引用:
[error] Cyclic reference involving
[error] {file:project/*:osgi-bundle
[error] {file:project/compile:full-classpath
[error] {file:project/compile:exported-products
[error] {file:project/compile:package-bin我对SBT很陌生,我不知道从这里往哪里走。任何帮助都将不胜感激。
发布于 2012-04-18 15:56:45
看来我最初通过推特提出的建议是行不通的。很抱歉。但幸运的是,我有马克·哈拉坐在我旁边,这里有一个可行的解决方案:
packagedArtifact in (Compile, packageBin) <<= (artifact in (Compile, packageBin), OsgiKeys.bundle).identityMap
artifact in (Compile, packageBin) ~= (_.copy(`type` = "bundle"))https://stackoverflow.com/questions/10210992
复制相似问题