Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
lhotari opened this issue Mar 22, 2017 · 8 comments

Comments

@lhotari
Copy link

lhotari commented Mar 22, 2017

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
Copy link
Author

lhotari commented Mar 22, 2017

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
Copy link
Author

lhotari commented Mar 22, 2017

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
Copy link
Author

lhotari commented Mar 22, 2017

Found https://issues.apache.org/jira/browse/SPARK-3812 / apache/spark#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
Copy link
Author

lhotari commented Mar 22, 2017

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

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

@ronmamo
Copy link
Owner

ronmamo commented Apr 7, 2017

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)

@tobymurray
Copy link

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>

raboof added a commit to akka/akka-http that referenced this issue Mar 26, 2019
raboof added a commit to akka/akka-http that referenced this issue Mar 26, 2019
@Woodz
Copy link

Woodz commented May 3, 2019

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.

@jalaziz
Copy link

jalaziz commented Mar 27, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants