This message was deleted.
# dependency-management
s
This message was deleted.
j
Or maybe the use of detached configurations should be discouraged in general? Right now it feels like a "not quite thought through" / "finished" concept to me.
v
I think it is the other way around. Detached configurations are fine, but when the capabilities were introduced this gap you observe was not properly considered. I think you are right and there is no way, at least I'm not aware of any. A detached configuration is for ad-hoc usage of a plugin to resolve some dependency without polluting the configurations of the project. I guess this should be reported as bug / shortcoming.
j
Detached configurations are fine, but when the capabilities were introduced this gap you observe was not properly considered.
Yes I agree.
I guess this should be reported as bug / shortcoming.
I'll open an issue (as I did not find an existing one).
👌 1
I tried to fix the concrete case by changing the input of the task in question. But the Android Gradle Plugin hard codes things so much that it is not possible to remove/change what it does when setting up the LinkTask. This is too opinionated in my mind. The nice thing about Gradle is usually that even if there are shortcoming like this, you can still do some customisation by reconfiguring tasks directly. It's unfortunate, that the Android Plugin seems to remove this flexibility on purpose (e.g. by calling
disallowChanges()
on task input file collections).
😞 1
Funny enough, this highlights how good it would be if more libraries/tools would detect such issues in their own builds already before they publish their dependencies. Problem is caused because
com.android.tools:repository
directly depends on the
javax
while it's transitive dependency depends on the same under the
jakarta
name. I doubt that this mismatch is on purpose.
v
Yeah, probably not 🙂
j
Of course in this case the root is (again) the so unnecessary move to suddenly put the
javax
package into the
jakarta
component. Which is causing so much pain across the whole ecosystem. I understand that sometimes are bad decisions and mistakes are made. But this was just so necessary....
FTR: Best solution I could come up with was to fix the metadata of
com.android.tools:repository
so that the conflict would not arise in the first place:
Copy code
withModule("com.android.tools:repository") {
        allVariants {
            withDependencies {
                removeIf { it.name == "javax.activation" }
                add("jakarta.activation:jakarta.activation-api")
            }
        }
    }
v
Ah, right, good solution finally. Well, at least a solution. 😄 Are you sure the rename was unnecessary? Could well be that they were not allowed to use "java" in the name because of some registered trademarks or similar.
j
Yes the general rename was necessary for legal reasons (although I don't like that as well). But what they did is doing it in two steps. Causing inconsistency between
package names
,
module coordinates
and jpms
module names
. For example for javax.activation
javax.activation:activation:1.1.1
-> contains
javax
package
jakarta.activation:jakarta.activation-api:1.2.1
-> still (!) contains
javax
package
jakarta.activation:jakarta.activation-api:2.0.0
-> contains
jakarta
package There should have never been a
1.x
version under the new coordinates (with the old package)
And this all on top that there are already conflicts, because often there is an API
jar
and an implementation
jar
, where the implementation also includes the API classes.
And then there are copies of some of the APIs under different names by glassfish and tomcat etc. So even without the name change the situation was already (too) complex.
v
Yeah, big ball of mud that always makes problems, I agree