This message was deleted.
# community-support
s
This message was deleted.
v
The problem of the error message, is that you use Groovy DSL. With that often error messages are little helpful. The message you got means "somewhere within
java { ... }
you messed up the syntax, but I cannot tell you where". You typically have to randomly comment out and in things to find out what the problem is. That is one of the reasons I recommend using Kotlin DSL. You instantly get type-safe build scripts, proper helpful error messages when messing up the syntax, and an amazingly better IDE support. In your case the problem is, that
exports { ... }
is not a thing I've ever seen and I'm using Gradle since pre-1.0.
d
Thanks @Vampire for quick response. I might be doing it incorrectly but based on my problem statement, please suggest how can I use only certain layer as dependency between modules.
v
Sorry, but I have no idea what your intention is, or what your snippet is supposed to do, or where you got it from.
d
Ok, my intention is "I have multi modules project and I am trying to expose only API layer/package from one module to other module". And for this I was looking different approaches.
That means if module 'A' has api and domain layer and module 'B' is having dependency on module 'A' but module 'A' wants to expose only api layer to module 'B'. I am trying to achieve it with gradle build @Vampire.
v
Are you using JPMS? i.e. the Java module system, so
module-info.java
and running on the module path, not class path?
Then the most trivial is to there define what you expose and what you don't as that is what it is for.
If you want to only do it Gradle-wise, you would either have one project for API and one for the other classes, or maybe have different source sets. Greatly depends on the exact gory details, so hard to give a general recommendation.
d
Thanks @Vampire right now I am using java 8 as mentioned in my last post. So I dont think I can use module-info.java. I am attaching screenshot and I have modules in name of proj_one and proj_two and trying to achieve conditional dependency in Gradle-wise.
v
Ah, right, did not see the Java 8, then of course no JPMS, yes.
What do you mean by "conditional dependency"?
If you just want to make sure
one
is only using
api
of
two
within your build, you might consider simply using something like
archunit
to verify such architectural constraints.
Otherwise as I said, you need to either split
two
into two projects, or at least two source sets.
d
Thanks @Vampire it makes sense and thanks a lot for all your inputs
👌 2