How to exclude library dependencies with explicit URL from generated pom?

I'm moving the Scala Migrations project from ant/ivy to sbt. It optionally uses log4jdbc as a library dependency that doesn't exist in any public Maven repository (from what I can find).

libraryDependencies +=
  "log4jdbc" % "log4jdbc" % "1.1" from ""

I'd like the generated POM to not include log4jdbc, since it's not in any repository. Is this a correct assumption that the POM will be better without listing log4jdbc? Also, will not listing it work better for Scala Migrations users using sbt?

I wrote the following setting to remove the log4jdbc dependency from the POM. Is there a better, easier way? Could a setting be added to sbt to do this automatically?

// Do not include log4jdbc as a dependency.
pomPostProcess := { (node: scala.xml.Node) =>
  val rewriteRule =
    new scala.xml.transform.RewriteRule {
      override def transform(n: scala.xml.Node): scala.xml.NodeSeq = {
        val name = n.nameToString(new StringBuilder).toString
        if (name == "dependency") {
          if ((n \ "groupId").text == "log4jdbc")
        else {
  val transformer = new scala.xml.transform.RuleTransformer(rewriteRule)


Because you mention a POM, I assume you want to support Maven users or you want to publish to a Maven repository. If that isn't true, you don't need to publish to a POM and you can just work with Ivy metadata like in the Ant/Ivy setup.

Since you know Ivy, the from(URL) method is essentially implemented by declaring a custom artifact with its from property set to the URL. Independent of Maven/POMs, Ivy doesn't include custom artifacts in the delivered Ivy file. (At least, I believe this is standard Ivy behavior and not something sbt configures Ivy to do.)

There isn't a way to provide the URL for a dependency in a pom.xml either, though. How you handle this might depend on what you expect clients to do, but one fairly general solution is to declare the dependency as optional:

libraryDependencies +=
  "log4jdbc" % "log4jdbc" % "1.1" % "compile,optional" from

Clients would need to explicitly declare the dependency in order to use it. Because it isn't a repository, sbt users would still need to duplicate the from "..." declaration. Maven users can only use dependencies in a repository, although they can install it in their local repository manually fairly easily.

Need Your Help

Customizing HTML5 Videos

html5 video html5-video customization

Can I dynamically change the videos in HTML5 to show custom content, for example the user name shown in the video?

PHP create a nicer way to echo variables

php variables replace

I am looking for a way to replace <?php echo $something; ?> with another notation like {$something}. But: No smarty or sth similar is used!

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.