This message was deleted.
# community-support
s
This message was deleted.
🤔 1
v
What do you mean exactly when you say "programmatically creating Gradle projects"?
s
Well, I'd like to have a project that I can refer to via
project(":name")
in another project's
build.gradle.kts
, but I don't want that project to exist "on disk", like by having its own
build.gradle.kts
file.
v
I hope you just want to depend on
project(":name")
but not configure it, because that is the same discouraged bad practice as using
allprojects { ... }
or
subprojects { ... }
for the same reasons.
But to answer your question, there is nothing necessary. Build scritps are optional. A project can very well live without an explicit build script, it is then just assumed to be empty.
But due to cross-project configuration being disouraged bad practice, such a project usually is useless 🙂
s
The longer story is that I'm creating Gradle project template for developing plugins for an application. For debugging convenience, I'd like to provide an application
runConfiguration
via the
idea-ext
Gradle plugin that runs the application with the plugin loaded. But my Gradle project for the plugin should not actually contain a project for the application the plugin is for. Still, I need to refer to the application's JAR as part of the run configuration.
v
What do you need a project for then? Just create a configuration (named or detached) that you use to resolve the application jar and its dependencies and use that for the generated run configuration.
s
Well, if I just refer to something like
project(":name")
, Gradle warns me
Project with path ':name' could not be found in root project 'app-plugin'
.
v
Yeah, you still have to declare it in the settings plugin.
s
I need the project for the module path of the run configuration, like
Copy code
moduleName = project(":cli").idea.module.name
And that programmatically created project needs to depend on the Maven artifacts for the application's CLI.
v
Where would the module name come from in that
cli
project?
s
Sorry, "cli" is just "name" from my earlier examples.
v
I got that, doesn't change my question 🙂
s
Then I didn't get the question 🙂
v
Where would the module name come from in that
name
project?
s
No idea, I assume it's some idea-ext plugin magic.
v
If you want an idea module, you need to have a Gradle project. But as you said you don't want a Gradle project, you will have no idea module.
My recommendation of above stands
Just do not set
moduleName
and instead use a custom configuration, that you then use to build a
--classpath
argument and that you set via
jvmArgs
on the run configuration
s
Ok, let's get back a step. In the end, what I'm trying to achieve is to programmatically create an IntelliJ run configuration that has JARs in its classpath that are not a dependency of any of the Gradle projects I currently have.
v
Or actually, the moduleName is maybe the name of the module of your actual project with the plugin code.
Ok, let's get back a step. In the end, what I'm trying to achieve is to programmatically create an IntelliJ run configuration that has JARs in its classpath that are not a dependency of any of the Gradle projects I currently have.
Yes, I got that 🙂
And my recommendation stands
s
I'll give the custom configuration approach a try.
👌 1
I guess I should use Gradle 8.4's new Resolvable role on
ConfigurationContainer
?
v
Exactly
Or well, if you do, you need two configurations. One "Dependency Scope" as the bucket where you declare your dependency and one "Resolvable" that extends it and can then be used to get the resolution result as path.
If you want to use only one configuration, you need to do it the old way, creating a configuration and setting
isCanBeConsumed
to
false
.