weird thing is it works perfectly fine in intellij
# announcements
s
weird thing is it works perfectly fine in intellij
n
If it works from intelliJ and maven it’s almost certainly a dependency issue - you’re getting a different version of the artifact then one you need. You could try blowing away your ~/.m2/repositories cach - if that doesn’t work run
gradle dependencies
and see what exactly gradle thinks you are getting.
s
I did try blowing away the whole cache. Almost all the dependencies match, nothing that would affect this is the wrong dependency.
n
Run the dependencies and look at the versions listed as used for the artifact. There’s nothing gradle does that inherently changes class loading so not sure where else to look. The only other silly wild guess would be the JDK getting used. If you’re like me and have a bunch around (IBMs,Amazons,Oracles,OpenJDK) etc could be how you’re running gradle is picking up some marginal JDK.
p
are we talking about java calling java here? (you mentioned kotlin.) I'd find the maven artifact id of the dependency that contains the constructor and use
gradlew dependencyInsight
to see which version you are getting. maven and gradle dependency resolution can produce different results, e.g., because they use different conflict resolution strategies (nearest vs. highest).
gradle's dependency cache is under
~/.gradle/caches
, but blowing it away is almost never the solution. (if it is, you found a gradle bug, or you really wanted
--refresh-dependencies
, which is typically avoidable by configuring appropriate ttl's for snapshots.)
s
If you look at my post you can see that it's a kotlin class being called by java. the thread over on the gradle channel has a lot more information. And I do know that about the cache folder, but I have tried everything including comparing dependency versions (and --refresh-dependencies). they all match up, except ones that I don't care about and would have no effect on whether a constructor actually gets called.
p
very much sounds like a versioning issue. that includes kotlin version, jdk version, etc.