简体   繁体   中英

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

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

Pass the configuration to use:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM