Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for excluding dependencies in pom.xml #71

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions publish/src/coursier/publish/Pom.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package coursier.publish

import coursier.core.{Configuration, ModuleName, Organization, Type}
import coursier.core.{Configuration, MinimizedExclusions, ModuleName, Organization, Type}

import scala.collection.mutable
import scala.xml.{Elem, Node, NodeSeq}
Expand Down Expand Up @@ -53,7 +53,13 @@ object Pom {
url: Option[String] = None,
name: Option[String] = None,
// TODO Accept full-fledged coursier.Dependency
dependencies: Seq[(Organization, ModuleName, String, Option[Configuration])] = Nil,
dependencies: Seq[(
Organization,
ModuleName,
String,
Option[Configuration],
MinimizedExclusions
)] = Nil,
license: Option[License] = None,
scm: Option[Scm] = None,
developers: Seq[Developer] = Nil
Expand Down Expand Up @@ -126,13 +132,21 @@ object Pom {
<dependencies>
{
dependencies.map {
case (depOrg, depName, ver, confOpt) =>
case (depOrg, depName, ver, confOpt, exclusions) =>
<dependency>
<groupId>{depOrg.value}</groupId>
<artifactId>{depName.value}</artifactId>
<version>{ver}</version>
{confOpt.fold[NodeSeq](Nil)(c => <scope>{c}</scope>)}
{
confOpt.fold[NodeSeq](Nil)(c => <scope>{c}</scope>)
if (exclusions.nonEmpty) <exclusions>{
exclusions.data.toSet().foreach { case (org, module) =>
<exclusion>
<groupId>{org.value}</groupId>
<artifactId>{module.value}</artifactId>
</exclusion>
}
}</exclusions>
}
</dependency>
}
Expand Down
Loading