Slackbot
08/31/2022, 2:40 PMJendrik Johannes
09/01/2022, 7:49 AM.module
file (Gradle basically ignores the pom
if the .module is there).
Looking at your module-c-2.0.module
I see that it points at module-c-1.0.jar
as artifacts. Which seems like the adjustment worked. (I am curious, how do you do that?)
I am not sure why it is not working. Can you share the error, or a complete example? Your Zip contains module-c, but there are dependencies to module-b
which are not in the ZIP.Jendrik Johannes
09/01/2022, 7:49 AMjava-platform
to manage all the versions. This platform gets âcomputedâ before publishing by comparing all Jars against the previous versions and then using versions depending on the comparison result. Unfortunately, setting this up is not trivial and I would have to remember details myself (although in the end it is an elegant solution I think).Fran Dragomanovic
09/02/2022, 12:09 PMmodule-c-2.0.pom
and module-c-2.0.module
pointing to the module-c-1.0.jar
. If you unpack it and add it to your maven repository and go to project and run ./gradlew build
you should get this message:
> Task :module-d:compileJava FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':module-d:compileJava'.
> Could not resolve all files for configuration ':module-d:compileClasspath'.
> Could not resolve org.example:module-c:2.0.
Required by:
project :module-d
> Could not resolve org.example:module-c:2.0.
> inconsistent module metadata found. Descriptor: org.example:module-c:1.0 Errors: bad version: expected='2.0' found='1.0'
Is there a way for this to be solved?
Btw, I manipulated these module-c-2.0.pom
and module-c-2.0.module
files manually for this purpose. Itâs not yet done dynamically. I wanted to have a small poc first to see if this concept would work.Jendrik Johannes
09/05/2022, 7:35 AM<version>2.0</version>
tag in the top of the POM (in fact, do not modify the POM at all).
You should also not modify the "component": { "version": "2.0" }
in the .module file.
This is, because in you approach the new version - 2.0
- is still a new version for Gradle. Thatâs why you canât mess with that part of the metadata. And you get the error you shared.
What you want to modify is only the artifact (the Jar file) that belongs to the ânewâ version.
Essentially, you only need to replace all occurrences of:
"name": "module-c-2.0.jar"
-> "name": "module-c-1.0.jar"
"url": "module-c-1.0.jar" -> "name": ../1.0/"module-c-1.0.jar"
Note that the ../<version>/
part in the âurlâ following the repository layout. (Itâ relative to the location of the metadata.)Fran Dragomanovic
09/05/2022, 8:20 AMExecution failed for task ':module-d:compileJava'.
> Could not resolve all files for configuration ':module-d:compileClasspath'.
> Could not find org.example:module-c:2.0.
Searched in the following locations:
- file:/Users/fran.dragomanovic/.m2/repository/org/example/module-c/2.0/module-c-2.0.pom
- <https://repo.maven.apache.org/maven2/org/example/module-c/2.0/module-c-2.0.pom>
Required by:
project :module-d
I attached the modified .m2 repository just to be sure I did the right thing.Jendrik Johannes
09/05/2022, 8:36 AMzip
you send looks correct and it works for me.Fran Dragomanovic
09/05/2022, 9:05 AMJendrik Johannes
09/05/2022, 9:13 AM.m2
unless you absolutely need it for integration with Maven.
I think .m2
is treated like a remote repo (from the caching perspective) so you would need to run --refresh-dependencies
if you change things in there.
Local file repos are treated differently (metadata is not cached as Gradle assumes it may change).Jendrik Johannes
09/05/2022, 9:13 AMFran Dragomanovic
09/05/2022, 9:18 AM