Home > Blockchain >  How do I use Gradle to implement an artifact in the custom jar task?
How do I use Gradle to implement an artifact in the custom jar task?

Time:06-17

Like this:

runtimeOnly(project.project(":project1").tasks.getByName<Jar>("shadowJar").archiveFile)

I do not want to use runtimeOnly(project("project1")), because the module has more than 2 jar artifacts.

But this is not true. result:

org.gradle.api.InvalidUserCodeException: Querying the mapped value of task ':project1:shadowJar' property 'archiveFile' before task ':project1:shadowJar' has completed is not supported

CodePudding user response:

Pass the configuration to use:

runtimeOnly project(path: ":project1", configuration: "shadow")
  • Related