mirror of https://github.com/sbt/sbt.git
Don't try to automatically detect a main artifact when packaging=pom. Fixes #636.
For the rare case where a main artifact is expected, add an explicit jar() to the dependency declaration.
This commit is contained in:
parent
a48ee68d17
commit
c5823ad1e7
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,3 @@
|
|||
class A {
|
||||
val x = classOf[org.apache.velocity.Template]
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
libraryDependencies += "org.apache.velocity" % "velocity" % "1.7" intransitive()
|
||||
|
|
@ -0,0 +1 @@
|
|||
libraryDependencies += "org.apache.velocity" % "velocity" % "1.5" intransitive() jar()
|
||||
|
|
@ -0,0 +1 @@
|
|||
libraryDependencies += "org.apache.velocity" % "velocity" % "1.5" intransitive()
|
||||
|
|
@ -0,0 +1 @@
|
|||
ivyPaths := new IvyPaths(baseDirectory.value, Some(target.value / "ivy-cache"))
|
||||
|
|
@ -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
|
||||
|
|
@ -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 <packaging-pom>` and gh-636.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ Library Management
|
|||
There's now a :doc:`getting started page </Getting-Started/Library-Dependencies>`
|
||||
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
|
||||
~~~~~~~~~~
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue