sbt发布的maven文件缺少具有多个范围的工件

时间:2016-11-10 11:23:28

标签: maven sbt

假设我的项目B取决于具有Atest->test范围的项目provided

val B = Project(
  id = "project-B",
  base = file("myproject"),
).dependsOn(A % "test->test;provided")

B发布的maven pom文件只有测试依赖项。

为什么遗漏了provided依赖关系?

更新

这是our project

中的实际SBT代码
lazy val streaming = Project(
id = "gearpump-streaming",
base = file("streaming"),
settings = commonSettings ++ myAssemblySettings ++ javadocSettings ++
  addArtifact(Artifact("gearpump-streaming"), sbtassembly.AssemblyKeys.assembly) ++
  Seq(
    assemblyMergeStrategy in assembly := {
      case "geardefault.conf" =>
        MergeStrategy.last
      case x =>
        val oldStrategy = (assemblyMergeStrategy in assembly).value
        oldStrategy(x)
    },

    libraryDependencies ++= Seq(
      "com.goldmansachs" % "gs-collections" % gsCollectionsVersion
    ),

    pomPostProcess := {
      (node: xml.Node) => changeShadedDeps(
        Set(
          "com.goldmansachs",
          "org.scala-lang",
          "org.scoverage"
        ),
        List(
          getShadedDepXML(organization.value, s"${core.id}_${scalaBinaryVersion.value}",
            version.value, "provided")),
        node)
    }
  )
).dependsOn(core % "test->test;provided")

pomPostProcess是从已发布的pom文件中删除不需要的依赖项,并在core范围内添加provided依赖项。

没有后者,pom文件就像

<?xml version='1.0' encoding='UTF-8'?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.gearpump</groupId>
<artifactId>gearpump-streaming_2.11</artifactId>
<packaging>jar</packaging>
<description>gearpump-streaming</description>
<version>0.8.2-SNAPSHOT</version>
<name>gearpump-streaming</name>
<organization>
    <name>org.apache.gearpump</name>
</organization>
<url>https://github.com/apache/incubator-gearpump</url>
<licenses>
    <license>
        <name>Apache 2</name>
        <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
</licenses>
<scm>
    <connection>scm:git://git.apache.org/incubator-gearpump.git</connection>
    <developerConnection>scm:git:git@github.com:apache/incubator-gearpump</developerConnection>
    <url>github.com/apache/incubator-gearpump</url>
</scm>
<developers>
    <developer>
        <id>gearpump</id>
        <name>Gearpump Team</name>
        <url>http://gearpump.incubator.apache.org/community.html#who-we-are</url>
    </developer>
</developers>
<dependencies>
    <dependency>
        <groupId>org.apache.gearpump</groupId>
        <artifactId>gearpump-core_2.11</artifactId>
        <version>0.8.2-SNAPSHOT</version>
        <scope>test</scope>
    </dependency>
</dependencies>

你可以看到&#34;提供了&#34;遗漏了依赖。

0 个答案:

没有答案