Maven pom doesn't correctly specify dependency type for aggregator pom

242 views
Skip to first unread message

rktoomey

unread,
Jul 6, 2012, 11:19:41 PM7/6/12
to simple-b...@googlegroups.com
Hi,

I have a project that depends on an aggregator pom for Casbah (https://github.com/novus/salat/blob/master/project/SalatBuild.scala).

    "org.mongodb" %% "casbah" % "2.4.0"

When I publish Maven style, the resulting pom doesn't correctly specify that the dependency type is a pom, not a jar (http://search.maven.org/remotecontent?filepath=com/novus/salat-core_2.9.1/1.9.0/salat-core_2.9.1-1.9.0.pom).   

<dependency>
<groupId>org.mongodb</groupId>
<artifactId>casbah_2.9.1</artifactId>
<version>2.4.1</version>
<scope>compile</scope>
</dependency>

This doesn't cause a problem when you use sbt for your project, but it does upset Maven proper which tries and fails to download a jar.  

How can I fix my build file so that the Casbah dependency shows correctly with <type>pom</type> in my artifacts?

Thanks,
Rose

Mark Harrah

unread,
Jul 8, 2012, 2:15:45 PM7/8/12
to simple-b...@googlegroups.com
Hi Rose,

On Fri, 6 Jul 2012 20:19:41 -0700 (PDT)
rktoomey <rkto...@gmail.com> wrote:

> Hi,
>
> I have a project that depends on an aggregator pom for Casbah (
> https://github.com/novus/salat/blob/master/project/SalatBuild.scala).
>
> "org.mongodb" %% "casbah" % "2.4.0"
>
> When I publish Maven style, the resulting pom doesn't correctly specify
> that the dependency type is a pom, not a jar (
> http://search.maven.org/remotecontent?filepath=com/novus/salat-core_2.9.1/1.9.0/salat-core_2.9.1-1.9.0.pom).
>
>
> <dependency>
> <groupId>org.mongodb</groupId>
> <artifactId>casbah_2.9.1</artifactId>
> <version>2.4.1</version>
> <scope>compile</scope>
> </dependency>
>
> This doesn't cause a problem when you use sbt for your project, but it does
> upset Maven proper which tries and fails to download a jar.

A solution appears to require modifying both make-pom to generate the <type> element as well as requiring such dependencies to explicitly declare the type/packaging like:

"org.mongodb" %% "casbah" % "2.4.0" type("pom")

(with some non-reserved substitute for type). 'type' can currently be done like:

artifacts( Artifact("casbah", "pom", "pom") )

or similar, but a `type` convenience method would make it a bit nicer. Please open a bug for this.

> How can I fix my build file so that the Casbah dependency shows correctly
> with* **<type>pom</type>* in my artifacts?

The immediate workaround is to post-process the pom.xml. The `pomPostProcess` setting is a transformation scala.xml.Node => scala.xml.Node that is called on the final pom.xml produced by make-pom.

pomPostProcess := { (pomXML: scala.xml.Node) =>
...
}

-Mark

> Thanks,
> Rose
>
> --
> You received this message because you are subscribed to the Google Groups "simple-build-tool" group.
> To view this discussion on the web visit https://groups.google.com/d/msg/simple-build-tool/-/MLlyfd6p0O8J.
> To post to this group, send email to simple-b...@googlegroups.com.
> To unsubscribe from this group, send email to simple-build-t...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/simple-build-tool?hl=en.
>

rktoomey

unread,
Jul 8, 2012, 6:22:49 PM7/8/12
to simple-b...@googlegroups.com
Thanks for your quick response, Mark!

I filed an issue for the type("pom") improvement:

And I added a pom post-processor to pick out the casbah dependency node and shim in <type>pom</type>:
Rose
> To post to this group, send email to simple-build-tool@googlegroups.com.
> To unsubscribe from this group, send email to simple-build-tool+unsubscribe@googlegroups.com.

Josh Suereth

unread,
Jul 8, 2012, 8:33:35 PM7/8/12
to simple-b...@googlegroups.com
Just note: This is going to be very important when, in scala 2.10 we have an aggregate artifact for scala-library-all that's a pom-type artifact that depends on all the others...

To view this discussion on the web visit https://groups.google.com/d/msg/simple-build-tool/-/nxP5PLeUjQsJ.

To post to this group, send email to simple-b...@googlegroups.com.
To unsubscribe from this group, send email to simple-build-t...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages