Fetch jar when pom.xml has "pom" packaging

79 просмотров
Перейти к первому непрочитанному сообщению

slan...@gatling.io

не прочитано,
24 нояб. 2016 г., 05:16:1324.11.2016
– sbt-dev
Hi there,

Some jars deployed on maven central have a "pom.xml" that has a "pom" packaging.

I personally would expect it to have a  instead of the expected "jar" and think such pom is broken (I opened an issue against Thrift).
It seems sbt has the same opinion, as it indeed doesn't add the libthrift jar to the classpath.
In order to reproduce, just add a dependency to "org.apache.thrift" % "libthrift" % "0.9.3" and import whatever Thrift class in your code. sbt will fail to compile.

Yet, maven disagrees and does add the jar.
So in the end, things work with maven while they don't with sbt, so I expect this problem to go completely unnoticed in the Java world, and don't expect to get enough traction to get those poms fixed.

The only workaround I found was to deploy on maven central an empty jar that would depend on libthrift.
In such case, sbt does fetch the transitive dependency jar.

Is there any way to get sbt to have the same behavior as maven?

Thanks in advance,

Stéphane

eugene yokota

не прочитано,
24 нояб. 2016 г., 05:29:5924.11.2016
– sbt...@googlegroups.com
Hi Stéphane,

So you want us to hack on Ivy code to reproduce Maven bug because Apache Thrift has a buggy POM file? We'll be happy to review a PR, but I'm not sure if that'll be high priority for sbt team tbh.

-eugene

Some links for other readers following this story:
https://maven.apache.org/guides/introduction/introduction-to-the-pom.html#Project_Aggregation


--
You received this message because you are subscribed to the Google Groups "sbt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sbt-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sbt-dev/fd66e271-fe2e-43f5-b803-e545fd78cada%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lutz Hühnken

не прочитано,
24 мар. 2017 г., 10:12:3724.03.2017
– sbt-dev
Hi Stéphane,

It's indeed super annoying, and it's really the Thrift project that should fix it. Please vote for this issue: https://issues.apache.org/jira/browse/THRIFT-3983

It's been discussed for coursier, see https://github.com/coursier/coursier/issues/410
When using coursier, for me, setting coursierDefaultArtifactType := "jar" helped.

Without coursier, i.e. using "normal" ivy resolution, I actually didn't have the problem. I thought it was because sbt set the default artifact type to "jar" anyway. But maybe I overlooked something. Anyway, you could try setting the artifact type explicitly, I think it would look something like
"org.apache.thrift" % "libthrift" % "0.9.3" artifacts(Artifact("libthrift", "jar", "jar"))


Please let me know if it helped.





On Thursday, 24 November 2016 11:29:59 UTC+1, eugene yokota wrote:
Hi Stéphane,

So you want us to hack on Ivy code to reproduce Maven bug because Apache Thrift has a buggy POM file? We'll be happy to review a PR, but I'm not sure if that'll be high priority for sbt team tbh.

-eugene

Some links for other readers following this story:
https://maven.apache.org/guides/introduction/introduction-to-the-pom.html#Project_Aggregation

On Thu, Nov 24, 2016 at 4:02 AM, <slan...@gatling.io> wrote:
Hi there,

Some jars deployed on maven central have a "pom.xml" that has a "pom" packaging.

I personally would expect it to have a  instead of the expected "jar" and think such pom is broken (I opened an issue against Thrift).
It seems sbt has the same opinion, as it indeed doesn't add the libthrift jar to the classpath.
In order to reproduce, just add a dependency to "org.apache.thrift" % "libthrift" % "0.9.3" and import whatever Thrift class in your code. sbt will fail to compile.

Yet, maven disagrees and does add the jar.
So in the end, things work with maven while they don't with sbt, so I expect this problem to go completely unnoticed in the Java world, and don't expect to get enough traction to get those poms fixed.

The only workaround I found was to deploy on maven central an empty jar that would depend on libthrift.
In such case, sbt does fetch the transitive dependency jar.

Is there any way to get sbt to have the same behavior as maven?

Thanks in advance,

Stéphane

--
You received this message because you are subscribed to the Google Groups "sbt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sbt-dev+u...@googlegroups.com.
Ответить всем
Отправить сообщение автору
Переслать
0 новых сообщений