reflections icon indicating copy to clipboard operation
reflections copied to clipboard

Using ${packaging.type} as value for packaging element in pom.xml of 0.9.11 prevents usage with sbt / ivy

Open lhotari opened this issue 8 years ago • 8 comments

The pom for 0.9.11 seems to be problematic for sbt / ivy. This is the change to pom.xml that causes the problem.

This is the error message I get:

[warn] 	[FAILED     ] org.reflections#reflections;0.9.11!reflections.${packaging.type}:  (0ms)
[warn] ==== local: tried
[warn]   /home/user/.ivy2/local/org.reflections/reflections/0.9.11/${packaging.type}s/reflections.${packaging.type}
[warn] ==== public: tried
[warn]   https://repo1.maven.org/maven2/org/reflections/reflections/0.9.11/reflections-0.9.11.${packaging.type}
[warn] ==== typesafe-releases: tried
[warn]   http://repo.typesafe.com/typesafe/releases/org/reflections/reflections/0.9.11/reflections-0.9.11.${packaging.type}
[warn] ==== typesafe-ivy-releasez: tried
[warn]   http://repo.typesafe.com/typesafe/ivy-releases/org.reflections/reflections/0.9.11/${packaging.type}s/reflections.${packaging.type}
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn] 	::              FAILED DOWNLOADS            ::
[warn] 	:: ^ see resolution messages for details  ^ ::
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::
[warn] 	:: org.reflections#reflections;0.9.11!reflections.${packaging.type}
[warn] 	::::::::::::::::::::::::::::::::::::::::::::::

lhotari avatar Mar 22 '17 08:03 lhotari

It seems to be a bug / feature in maven that variables aren't replaced into the installed pom file: https://issues.apache.org/jira/browse/MNG-2971 .

lhotari avatar Mar 22 '17 09:03 lhotari

I found an ugly workaround for sbt / ivy. Setting a system property "packaging.type" to "jar" makes the resolution succeed, for example sbt -Dpackaging.type=jar update. It seems that Ivy only supports pom files that don't have properties in the elements that are important for dependency resolution. However it does resolve the properties from system properties.

lhotari avatar Mar 22 '17 09:03 lhotari

Found https://issues.apache.org/jira/browse/SPARK-3812 / https://github.com/apache/spark/pull/2673 which solves a similar problem. It uses a hack to get maven-shade-plugin to create an effective pom file without actually shading dependencies.

lhotari avatar Mar 22 '17 09:03 lhotari

Found another workaround for sbt, adding this line to build.sbt helps:

sys.props += "packaging.type" -> "jar"

lhotari avatar Mar 22 '17 09:03 lhotari

This might help for the meanwhile: libraryDependencies += "org.reflections" %% "reflections" % "0.9.11" artifacts( Artifact("reflections", "", "jar"))

Current 0.9.11 artifact in repo1 is w/o the ${packaging.type} variable (I've pushed it again, bad-bad-bad) And just committed (c328834) a fix to this (source head 0.9.12-SNAPSHOT)

ronmamo avatar Apr 07 '17 08:04 ronmamo

We've just run into this as well, using the current version of 0.9.11 Ivy can't handle ${packaging.type}. Similar to others, Ivy can make use of this by explicitly setting the packaging type, e.g.:

<dependency org="org.reflections" name="reflections" rev="0.9.11" conf="build->default">
    <artifact name="reflections" type="jar" />
</dependency>

tobymurray avatar Apr 19 '18 15:04 tobymurray

This might help for the meanwhile: libraryDependencies += "org.reflections" %% "reflections" % "0.9.11" artifacts( Artifact("reflections", "", "jar"))

Current 0.9.11 artifact in repo1 is w/o the ${packaging.type} variable (I've pushed it again, bad-bad-bad) And just committed (c328834) a fix to this (source head 0.9.12-SNAPSHOT)

@ronmamo there are some mirrors of the 0.9.11 artefact that still have this issue, which is causing sporadic issues. I am trying to identify them so that I can request that they delete the erroneous artefact, but to ensure that no mirrors or caches still have this issue, I strongly recommend creating a new release and encouraging your dependants to move to latest.

Woodz avatar May 03 '19 03:05 Woodz

Looks like JCenter still has the bad POM: https://bintray.com/bintray/jcenter/org.reflections%3Areflections/0.9.11

jalaziz avatar Mar 27 '20 06:03 jalaziz