diff --git a/ivy/src/main/scala/sbt/Ivy.scala b/ivy/src/main/scala/sbt/Ivy.scala index 30b19368f..3ffb8121d 100644 --- a/ivy/src/main/scala/sbt/Ivy.scala +++ b/ivy/src/main/scala/sbt/Ivy.scala @@ -242,8 +242,14 @@ private object IvySbt // Technically, this should be applied to module configurations. // That would require custom subclasses of all resolver types in ConvertResolver (a delegation approach does not work). // It would be better to get proper support into Ivy. - override def locate(artifact: IArtifact) = - if(hasImplicitClassifier(artifact)) null else super.locate(artifact) + // + // This method is only used by the pom parsing code in Ivy to find artifacts it doesn't know about. + // In particular, a) it looks up source and javadoc classifiers b) it looks up a main artifact for packaging="pom" + // sbt now provides the update-classifiers or requires explicitly specifying classifiers explicitly + // Providing a main artifact for packaging="pom" does not seem to be correct and the lookup can be expensive, so + // sbt now requires this artifact to be explicitly declared. + override def locate(artifact: IArtifact) = null +// if(hasImplicitClassifier(artifact)) null else super.locate(artifact) override def getDependency(dd: DependencyDescriptor, data: ResolveData) = { if(data.getOptions.getLog != LogOptions.LOG_QUIET) diff --git a/sbt/src/sbt-test/dependency-management/packaging-pom/A.scala b/sbt/src/sbt-test/dependency-management/packaging-pom/A.scala new file mode 100644 index 000000000..043d6a0c4 --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/packaging-pom/A.scala @@ -0,0 +1,3 @@ +class A { + val x = classOf[org.apache.velocity.Template] +} \ No newline at end of file diff --git a/sbt/src/sbt-test/dependency-management/packaging-pom/changes/pkgjar.sbt b/sbt/src/sbt-test/dependency-management/packaging-pom/changes/pkgjar.sbt new file mode 100644 index 000000000..452238a57 --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/packaging-pom/changes/pkgjar.sbt @@ -0,0 +1 @@ +libraryDependencies += "org.apache.velocity" % "velocity" % "1.7" intransitive() \ No newline at end of file diff --git a/sbt/src/sbt-test/dependency-management/packaging-pom/changes/pkgpom-explicit.sbt b/sbt/src/sbt-test/dependency-management/packaging-pom/changes/pkgpom-explicit.sbt new file mode 100644 index 000000000..1c8061659 --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/packaging-pom/changes/pkgpom-explicit.sbt @@ -0,0 +1 @@ +libraryDependencies += "org.apache.velocity" % "velocity" % "1.5" intransitive() jar() \ No newline at end of file diff --git a/sbt/src/sbt-test/dependency-management/packaging-pom/changes/pkgpom.sbt b/sbt/src/sbt-test/dependency-management/packaging-pom/changes/pkgpom.sbt new file mode 100644 index 000000000..e20120f24 --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/packaging-pom/changes/pkgpom.sbt @@ -0,0 +1 @@ +libraryDependencies += "org.apache.velocity" % "velocity" % "1.5" intransitive() \ No newline at end of file diff --git a/sbt/src/sbt-test/dependency-management/packaging-pom/common.sbt b/sbt/src/sbt-test/dependency-management/packaging-pom/common.sbt new file mode 100644 index 000000000..70ab07db3 --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/packaging-pom/common.sbt @@ -0,0 +1 @@ +ivyPaths := new IvyPaths(baseDirectory.value, Some(target.value / "ivy-cache")) \ No newline at end of file diff --git a/sbt/src/sbt-test/dependency-management/packaging-pom/test b/sbt/src/sbt-test/dependency-management/packaging-pom/test new file mode 100644 index 000000000..28b3233c0 --- /dev/null +++ b/sbt/src/sbt-test/dependency-management/packaging-pom/test @@ -0,0 +1,16 @@ +# velocity 1.5, packaging=pom, but has a main jar +# this verifies that sbt does not retrieve it by default +$ copy-file changes/pkgpom.sbt dep.sbt +> reload +-> compile + +# with an explicit jar(), sbt should know about it without +# needing to ping the repository +$ copy-file changes/pkgpom-explicit.sbt dep.sbt +> reload +> compile + +# velocity 1.7, packaging=jar, so this should pull in a main jar as usual +$ copy-file changes/pkgjar.sbt dep.sbt +> reload +> compile diff --git a/src/sphinx/Community/ChangeSummary_0.13.0.rst b/src/sphinx/Community/ChangeSummary_0.13.0.rst index 6d4acd92d..c98b56283 100644 --- a/src/sphinx/Community/ChangeSummary_0.13.0.rst +++ b/src/sphinx/Community/ChangeSummary_0.13.0.rst @@ -13,6 +13,7 @@ Features, fixes, changes with compatibility implications (incomplete, please hel - Support for plugin configuration in ``project/plugins/`` has been removed. It was deprecated since 0.11.2. - Dropped support for tab completing the right side of a setting for the ``set`` command. The new task macros make this tab completion obsolete. - The convention for keys is now camelCase only. Details below. +- sbt no longer looks for main artifacts for poms with `packaging="pom"`. For details, see the :ref:`relevant Library Management section ` and gh-636. Features -------- diff --git a/src/sphinx/Detailed-Topics/Library-Management.rst b/src/sphinx/Detailed-Topics/Library-Management.rst index 12936461e..3fbbf6578 100644 --- a/src/sphinx/Detailed-Topics/Library-Management.rst +++ b/src/sphinx/Detailed-Topics/Library-Management.rst @@ -5,7 +5,7 @@ Library Management There's now a :doc:`getting started page ` about library management, which you may want to read first. -*Wiki Maintenance Note:* it would be nice to remove the overlap between +*Documentation Maintenance Note:* it would be nice to remove the overlap between this page and the getting started page, leaving this page with the more advanced topics such as checksums and external Ivy files. @@ -399,6 +399,22 @@ The default value is: checksums := Seq("sha1", "md5") +.. _packaging-pom: + +packaging="pom" +~~~~~~~~~~~~~~~ + +A pom.xml that has `packaging="pom"` is not supposed to have artifacts. +However, some published poms have an associated main artifact, so Ivy checks if one exists. +This check can be time consuming to the point of taking most of the time for `update` on larger projects. +Therefore, sbt disables this check and requires you to explicitly request the main jar. + +For example, + +:: + + libraryDependencies += "org.apache.velocity" % "velocity" % "1.5" jar() + Publishing ~~~~~~~~~~