jakartaee / rest

Jakarta RESTful Web Services

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

2.1 maven integration issue

glassfishrobot opened this issue · comments

I'm not sure if this is the right place to post this, but here goes.
I'm attempting to pull in jax-rs 2.1 in Gradle. Gradle complains that it can't resolve due to:
Could not HEAD 'http://central.maven.org/maven2/javax/ws/rs/javax.ws.rs-api/2.1/javax.ws.rs-api-2.1.$%7Bpackaging.type%7D'

As you can see, the packaging .type variable is not getting resolved. I'm wondering if it's because the maven profile isn't getting set due to an incorrect value.

The [jax-rs 2.1 POM][1] defines the "jdk8-" profile as:

jdk8-

(,9)

..

I'm wondering if the (,9) is preventing any profile from getting picked up:
(,9)

According to the maven [range spec][2], should it be:
(,1.9)

@ChristianCiach Commented
2.1 is a dependency for Jersey Core Server » 2.26, so we cannot use Jersey Server at the moment. Even the download button is broken: https://mvnrepository.com/artifact/javax.ws.rs/javax.ws.rs-api/2.1

@pavelbucek Commented
This seems like a gradle issue.

(we don't see that in maven and we are referencing jax-rs api in multiple places; I don't believe this is related to any profile declared in pom.xml).

@ChristianCiach Commented
I am not convinced that it is a gradle issue.

I can't find anything about a magic variable called ${packaging.type} and there is no <properties>-block inside the pom file to declare any custom defined properties..

@ChristianCiach Commented
I am sorry, I am wrong. There is a custom properties-block to declare this variable. I will ask the gradle guys for support.

@ChristianCiach Commented
Gradle has very limited support for pom-profiles, which are discouraged to use anyway - so much so, that even mvnrepository.com can't generate a download link.

It would be nice if you at least could define a profile that is active by default:

<profile><activation><activeByDefault>true</activeByDefault></activation></profile>

Such a profile is picked up by gradle. You can still override these properties depending on the JDK-versions. Gradle will ignore these additional profiles.

Is this something you could do for us gradle users, please?

@pavelbucek Commented
As stated in the email communication, we can't just do that. Released artifacts are immutable.

And since this is not a bug in JAX-RS deployment descriptor - the issue is in how gradle parses/uses pom files - I don't see this as a reason for 2.1.1 release.

@crizo23 Commented
So where does responsibility lie for a pom.xml that doesn't play nice? Currently, Jersey/Swagger gradle users are negatively affected by this. Am I incorrect that these projects are the "customers" of jax-rs? Isn't jax-rs concerned with maximum adoption rate by making integration as easy as possible?

@ibaca Commented
Uhm, using a maven property in the type seems pretty bad idea. Anyway, I just created a gradle project and added compile group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: '2.1' and it works correctly so you should have some other problem.

@ChristianCiach Commented

I just created a gradle project and added compile group: 'javax.ws.rs', name: 'javax.ws.rs-api', version: '2.1' and it works correctly

It does not work for me. What repository and gradle version are you using?

@ibaca Commented
Version gradle-3.5-rc-2 and mavenCentral() (I just created a new gradle project on intellij). And after updating to the last version 4.2.1 it works too.

@sslavic Commented
This broke sbt builds too, probably because sbt uses Apache Ivy just like Gradle.

In my case jax-rs api is a transitive dependency. As workaround tried ronmamo/reflections#169 (comment) and sbt/sbt#3618 (comment) but neither worked fully - with Ivy cache clean, initial build would fail. Only workaround that handles well clean local repo case was to explicitly add dependency to jax-rs api and defining jar artifact

libraryDependencies += "javax.ws.rs" % "javax.ws.rs-api" % "2.1" artifacts( Artifact("javax.ws.rs-api", "jar", "jar")), // this is a workaround for https://github.com/jax-rs/api/issues/571

@maltem-za Commented
See my linked issue #572 for an Ivy fix