Permalink
Browse files

Revert packaging='pom' behavior change introduced in c5823ad. Fixes #810

.  Ref #636.
  • Loading branch information...
1 parent 544565b commit d8b3118ba4b9920ebaec2ac16901c34f4d63b404 @harrah harrah committed Jul 11, 2013
@@ -245,14 +245,17 @@ 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.
+ // A workaround is to configure the ModuleConfiguration resolver to be a ChainResolver.
//
// 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)
+ // Providing a main artifact for packaging="pom" does not seem to be correct and the lookup can be expensive.
+ //
+ // Ideally this could just skip the lookup, but unfortunately several artifacts in practice do not follow the
+ // correct behavior for packaging="pom" and so it is only skipped for source/javadoc classifiers.
+ override def locate(artifact: IArtifact) = if(hasImplicitClassifier(artifact)) null else super.locate(artifact)
+
override def getDependency(dd: DependencyDescriptor, data: ResolveData) =
{
if(data.getOptions.getLog != LogOptions.LOG_QUIET)
@@ -1,24 +0,0 @@
-import sbt._
-import Keys._
-
-object PomTest extends Build
-{
- override def settings = super.settings :+ (TaskKey[Unit]("check-pom") <<= checkPom)
-
- lazy val subJar = Project("sub-jar", file("subJar"))
- lazy val subWar = Project("sub-war", file("subWar")) settings( warArtifact)
- lazy val subParent = Project("sub-parent", file("subParent")) settings( publishArtifact in Compile := false )
-
- def art(p: ProjectReference) = makePom in p
- def checkPom = (art(subJar), art(subWar), art(subParent)) map { (jar, war, pom) =>
- checkPackaging(jar, "jar")
- checkPackaging(war, "war")
- checkPackaging(pom, "pom")
- }
- def checkPackaging(pom: File, expected: String) =
- {
- val packaging = (xml.XML.loadFile(pom) \\ "packaging").text
- if(packaging != expected) error("Incorrect packaging for '" + pom + "'. Expected '" + expected + "', but got '" + packaging + "'")
- }
- def warArtifact = artifact in (Compile, packageBin) ~= { _.copy(`type` = "war", extension = "war") }
-}
@@ -1 +0,0 @@
-> check-pom
@@ -13,7 +13,6 @@ 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 <packaging-pom>` and gh-636.
- Fixed the default classifier for tests to be ``tests`` for proper Maven compatibility.
- The global settings and plugins directories are now versioned. Global settings go in ``~/.sbt/0.13/`` and global plugins in ``~/.sbt/0.13/plugins/`` by default. Explicit overrides, such as via the ``sbt.global.base`` system property, are still respected. (gh-735)
- sbt no longer canonicalizes files passed to scalac. (gh-723)
@@ -513,23 +513,6 @@ This is confirmed by the output of ``show update``:
**Note:** this is an Ivy-only feature and will not be included in a published pom.xml.
-
-.. _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
~~~~~~~~~~

0 comments on commit d8b3118

Please sign in to comment.