Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using a custom gradle dependency configuration #78

Closed
bjorndarri opened this issue Aug 22, 2019 · 4 comments
Closed

Using a custom gradle dependency configuration #78

bjorndarri opened this issue Aug 22, 2019 · 4 comments

Comments

@bjorndarri
Copy link

I have a gradle configuration in a project of mine:

configurations { serverRuntime { extendsFrom compile } }

I can then use this configuration, for example:

task runServer(type: ModularJavaExec) { classpath = configurations.serverRuntime }

and

startScripts { classpath = configurations.serverRuntime }

but I have not found a way to use this specific configuration in jlink, which seems to use the default runtime configuration.

Is there a way to specify a configuration for jlink?

@bjorndarri bjorndarri changed the title Using a custom gradle configuration Using a custom gradle dependency configuration Aug 22, 2019
@bjorndarri
Copy link
Author

I've been looking at the code and found a reference to

project.configurations['runtimeClasspath']

in the DependencyManager constructor. I played around with adding a Configuration parameter to the constructor but got quickly bogged down by all the places I had to change, I got as far as adding a Configuration variable to JLinkTaskData and a Property<Configuration> to JLinkPluginExtension (with default value as project.configurations['runtimeClasspath']) but stopped there since I don't have any experience in groovy or gradle plugin development.

At least this looks possible, by adding a org.gradle.api.artifacts.Configuration parameter to the task.

@siordache
Copy link
Member

The next release will support custom configurations.

@siordache
Copy link
Member

Implemented in release 2.15.0.
Usage:

jlink {
    configuration = 'serverRuntime'
    ...
}

@bjorndarri
Copy link
Author

Fantastic, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants