Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix circular dependencies #8

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

hanslovsky
Copy link
Member

@hanslovsky hanslovsky commented Apr 10, 2021

The Fiji updater reports circular dependencies when trying to upload to ntakt updae site. Thanks to help from @ctrueden I was able to identify duplicate classes that appear both in the shaded scripting-kotlin jar and the org.jetbrains.kotlin:kotlin-script-runtime:jar:1.4.30:runtime transitive dependency. The org.jetbrains.kotlin:kotlin-compiler-embeddable:jar:1.4.30:compile dependency that pulls in this transitive dependency is marked as optional. No other dependency has kotlin-script-runtime as dependency so I am a bit confused about why kotlin-script-runtime is installed in the first place. Removing it from the shaded jar solved the issue of duplicate classes. I have yet to confirm that the Fiji updater does not report any circular dependencies after this fix.

For reference, discussion on gitter

For completeness, this is the Maven dependency tree:

org.scijava:scripting-kotlin:jar:0.1.2-SNAPSHOT
+- org.scijava:scijava-common:jar:2.83.3:compile
|  +- org.scijava:parsington:jar:2.0.0:compile
|  \- org.bushe:eventbus:jar:1.4:compile
+- org.jetbrains.kotlin:kotlin-compiler-embeddable:jar:1.4.30:compile
|  +- org.jetbrains.kotlin:kotlin-script-runtime:jar:1.4.30:runtime
|  +- org.jetbrains.kotlin:kotlin-reflect:jar:1.4.30:runtime
|  +- org.jetbrains.kotlin:kotlin-daemon-embeddable:jar:1.4.30:runtime
|  \- org.jetbrains.intellij.deps:trove4j:jar:1.0.20181211:runtime
+- org.jetbrains.kotlin:kotlin-stdlib:jar:1.4.30:compile
|  +- org.jetbrains.kotlin:kotlin-stdlib-common:jar:1.4.30:compile
|  \- org.jetbrains:annotations:jar:13.0:compile
+- org.jetbrains.kotlin:kotlin-scripting-jsr223:jar:1.4.30:compile
|  +- org.jetbrains.kotlin:kotlin-scripting-common:jar:1.4.30:runtime
|  |  \- org.jetbrains.kotlinx:kotlinx-coroutines-core:jar:1.3.8:runtime
|  +- org.jetbrains.kotlin:kotlin-scripting-jvm:jar:1.4.30:runtime
|  +- org.jetbrains.kotlin:kotlin-scripting-jvm-host:jar:1.4.30:runtime
|  \- org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:jar:1.4.30:runtime
|     \- org.jetbrains.kotlin:kotlin-scripting-compiler-impl-embeddable:jar:1.4.30:runtime
+- junit:junit:jar:4.13:test
|  \- org.hamcrest:hamcrest-core:jar:1.3:test
\- org.jetbrains.kotlin:kotlin-stdlib-jdk8:jar:1.4.30:compile
   \- org.jetbrains.kotlin:kotlin-stdlib-jdk7:jar:1.4.30:compile

Solution

I found out that org.jetbrains.kotlin:kotlin-scripting-jsr223:jar has kotlin-compiler-embeddable as a transitive dependency with scope runtime. For some reason, this transitive dependency would only show in mvn dependency:tree when I did not have kotlin-compiler-embeddable as dependency for scripting-kotlin. In the end, the solution was to simply include kotlin-scripting-jsr233 and its transitive dependencies in the shaded jar. I tested this branch in a clean Fiji.app and distributed/ to/installed from the ntakt update site.

kotlin-script-runtime would be installed alongside shaded jar into Fiji.app/jars directory and cause duplicate classes issue.
@hanslovsky hanslovsky marked this pull request as ready for review April 11, 2021 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant