bc-java icon indicating copy to clipboard operation
bc-java copied to clipboard

New gradle setup does not play nicely with Intellij

Open vanitasvitae opened this issue 1 year ago • 7 comments

Hey, as outlined in my comment on https://github.com/bcgit/bc-java/commit/05594043c82ab45bf3b12a5cf5e86a584b83f888 the new gradle setup causes hurdles for development using Intellij.

Intellij complains about a duplicate content root for the pg module. If I manually set back pg/src/main/java as content root, there are dependency issues resolving core.prov. If instead I mark generated-src as content root, Intellij keeps opening the generated source files when I want to make changes, which are then obviously overwritten as soon as gradle re-generates those files from the true sources.

Currently, these changes unfortunately make it very hard to work on BC :/ If you have any tips for me on how to resolve this, apart from basing my branches onto commits before the change, let me know!

vanitasvitae avatar Oct 25 '24 10:10 vanitasvitae

We think the issue related to core:prov might now be dealt with. Let us know how it's currently looking.

dghgit avatar Oct 28 '24 21:10 dghgit

On the latest main branch, after reopening the project, pg/src/main/jdk1.9 is still marked as content root and pg/src/main/java is unmarked, such that the source files are not picked up by the IDE.

If I manually mark pg/src/main/java as content root, the IDE picks up those files, but still fails to resolve some dependencies like org.bouncycastle.util.Arrays. I can fix this by manually adding a dependency to workingdir.bc-java.core.main (somethings strange here plus it actually doesn't cause any changes to the build scripts, but apparently resolves the issue in Intellij), however, as soon as I reload the gradle project, those changes are reverted, as the content root again is set to the jdk1.9 directory.

vanitasvitae avatar Oct 29 '24 08:10 vanitasvitae

Okay, that's fairly weird... I'm beginning to remember why I still don't use gradle in IntelliJ... will have to think on this, wondering if there is some "secret sauce" IntelliJ will read from a gradle script that applies to it only. Getting 1.79 out the door at the moment, so it may take a while.

dghgit avatar Oct 29 '24 22:10 dghgit

Any updates on the gradle situation? With the latest release, the situation seemingly got worse. Now I cannot get test cases to resolve their dependencies anymore, as SimpleTest etc. cannot be located.

vanitasvitae avatar Nov 27 '25 23:11 vanitasvitae

Oh dear... so gradle now set up for Java 25 and using 9.1.0... What version does Intellij think it's using?

dghgit avatar Nov 28 '25 00:11 dghgit

My Intellij is using Gradle 9.1.0 as well. Still, SimpleTest cannot be resolved from the pg tests.

vanitasvitae avatar Nov 28 '25 12:11 vanitasvitae

I've got a feeling this might be an issue about the split between prov and core - prov is built from prov + core, simple test is in core, but the pg library depends on prov. It sounds like IntelliJ isn't recognising the extra dependency. I suspect "fixing" this properly may involve combining prov and core and building the provider and the lcrypto classes from the same module... not sure...

dghgit avatar Nov 29 '25 02:11 dghgit

As a point of reference: Commit 727e864630b5b7bac8ece1a0159492aa3b024c77 works fine in Intellij, but after this commit things break.

vanitasvitae avatar Dec 16 '25 20:12 vanitasvitae