microsoft / microsoft/kiota-java
microsoft-kiota-** dependencies have conflicting Automatic-Module-Name
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 38
- Forks
- 34
- Avg merge
- 15h 9m
- Merged PRs (30d)
- 20
Description
We use for our projects both `jdeps` and `jlink` tools to generate a slim JRE. However since the switch to `com.microsoft.graph:microsoft-graph:6.4.0` (v6 of the SDK, recently released), which builds on top of the `microsoft-kiota-**` dependencies. We can't seem to run our `jdeps` command succesfully anymore.
Previously (without the `microsoft-kiota-**` dependencies on the class-/module path we have been using the following command; (exectued from `target/`)
```
jdeps --multi-release base --recursive --ignore-missing-deps --print-module-deps --class-path="./lib/*" --module-path="./lib/*" -quiet demo-0.0.1-SNAPSHOT.jar
```
Which would list something like this; _java.base,spring.boot,spring.boot.autoconfigure,spring.context,spring.core_
Note: When running this on a Windows machine, be sure to change `./lib/*` to `./lib` (as there is an issue with the `*` wildcard.
Howafter after switching to `com.microsoft.graph:microsoft-graph:6.4.0` we not get the following exception when we run the same command;
```
Exception in thread "main" java.lang.module.FindException: Two versions of module com.microsoft.kiota found in .\lib (microsoft-kiota-authentication-azure-1.0.4.jar and microsoft-kiota-abstractions-1.0.4.jar)
at java.base/jdk.internal.module.ModulePath.scanDirectory(ModulePath.java:295)
at java.base/jdk.internal.module.ModulePath.scan(ModulePath.java:233)
at java.base/jdk.internal.module.ModulePath.scanNextEntry(ModulePath.java:191)
at java.base/jdk.internal.module.ModulePath.findAll(ModulePath.java:167)
at jdk.jdeps/com.sun.tools.jdeps.JdepsConfiguration$Builder.build(JdepsConfiguration.java:558)
at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.buildConfig(JdepsTask.java:607)
at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:561)
at jdk.jdeps/com.sun.tools.jdeps.JdepsTask.run(JdepsTask.java:537)
at jdk.jdeps/com.sun.tools.jdeps.Main.main(Main.java:50)
```
A quick look here in the repository shows me that all `components/**/build.gradle` files are containing this piece of code;
```groovy
tasks.jar {
manifest {
attributes('Automatic-Module-Name': project.property('mavenGroupId'))
}
}
```
So the `Automatic-Module-Name` is set to an unique value, which isn't correct in my opinion. Might be better to use the `artifactId` here maybe? But that is up to you guys ;)
Following `pom.xml` file can be used to simulate this issue. Note the `maven-dependency-plugin` which copies all the dependencies (on `mvn install`) to `target/lib` for easier testing with the command.
```xml
4.0.0
org.springframework.boot
spring-boot-starter-parent
3.2.3
com.example
demo
0.0.1-SNAPSHOT
demo
Demo project for Spring Boot
21
6.4.0
1.11.2
org.springframework.boot
spring-boot-starter
com.microsoft.graph
microsoft-graph
${microsoft-graph.version}
com.azure
azure-identity
${azure-identity.version}
compile
org.springframework.boot
spring-boot-maven-plugin
org.apache.maven.plugins
maven-dependency-plugin
install
copy-dependencies
${project.build.directory}/lib
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect the `tasks.jar` manifest configuration in `components/**/build.gradle`, then reproduce the conflict with the supplied `pom.xml` and the documented `jdeps` command. Confirm that the generated Kiota JARs no longer produce duplicate `com.microsoft.kiota` module names and that `jdeps` completes successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100