This message was deleted.
# community-support
s
This message was deleted.
t
Because you're creating subprojects referencing sibling directories, the settings.gradle from those other directories are not taken into account. So either add a subproject
:observability:bundle
to
engine
, or better: use composite builds instead: https://docs.gradle.org/current/userguide/composite_builds.html
e
I tried adding
:observability:bundle
to
engine
but that did not work either... settings.gradle
Copy code
include ':observability:bundle'
project(':observability').projectDir = file('../observability')
project(':observability:bundle').projectDir = file('../observability/bundle')
eric.kolotyluk@Y2RCV7009N engine % ./gradlew build
FAILURE: Build failed with an exception.
* What went wrong:
Could not determine the dependencies of task ':distTar'.
> Could not resolve all task dependencies for configuration ':runtimeClasspath'.
> Could not resolve project observabilitybundle.
Required by:
project : > project :common-utils
> No matching configuration of project observabilitybundle was found. The consumer was configured to find a runtime of a library compatible with Java 11, packaged as a jar, preferably optimized for standard JVMs, and its dependencies declared externally but:
- None of the consumable configurations have attributes.
I have tried reading "Composing builds" several times, and it really makes my head hurt. I will try again...
t
Shouldn't it be
../../observability
rather than
../observability
?
๐Ÿ™Œ 1
e
Oh crap... right you are... ๐Ÿ™„ thanks... Now I feel stupid... Copy/Paste problems... This is where better diagnostics in Gradle could help. Such as displaying some context, such as the absolute path of where it is looking for things... I am still getting
Copy code
eric.kolotyluk@Y2RCV7009N engine % ./gradlew build

> Task :common-utils:compileJava
Note: /Users/eric.kolotyluk/git/autonomous-iam/utils/src/main/java/com/forgerock/autoid/jsonTransform/JSLT.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

> Task :jar FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':jar'.
> Entry com/forgerock/autoid/jsonTransform/Module$Factory.class is a duplicate but no duplicate handling strategy has been set. Please refer to <https://docs.gradle.org/7.5.1/dsl/org.gradle.api.tasks.Copy.html#org.gradle.api.tasks.Copy:duplicatesStrategy> for details.
but I think I know how to fix that...
Copy code
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
solves that problem ๐Ÿ™‚
v
Do never ever do that. A project should always only be part of one build and not included to another build like you do it there. This way your will just get a lot of unexpected behavior and problems. As Thomas already said - just imho not emphasized enough - you should use composite builds for your use-case.
๐Ÿคจ 1
e
๐Ÿคจ Hmmm... primarily, I am working in a mono repo, a Big Ball of Mud that was started before I got here... and now I am learning Gradle... If I understand @Vampire and others, we really need to rethink how we are using Gradle... ๐Ÿคซ I transitioned from Ant to Maven in about 2010, and learned to build things according to Maven principles. I am still relatively new to Gradle. Part of the reason I am having trouble is trying to fathom this BBOM I have inherited, with a Hodge Podge of indiscernible Gradle practices. Does anyone know of any really well designed Gradle projects that we could look at as examples?
v
Hopefully the Gradle build itself. And there is for example also https://github.com/jjohannes/idiomatic-gradle/ which usually is quite good.
๐Ÿ™Œ 1
e
WOW! ๐Ÿฅณ This looks awesome... thanks!
๐Ÿ‘Œ 1