简体   繁体   中英

How can I import groovy class to build.gradle script?

I have this project structure:

在此输入图像描述

And I try to use these classes in build.gradle script:

task generateStubs(type: XjcExecTask) {

But Gradle doesn't see this class XjcExecTask .

I try to add import com.pavel.* to this script but it doesn't recognize.

If your custom Groovy classes XjcExecTask and WsimportExecTask purpose is to be used by your build script only (and not packaged into a library you will share to other projects), then you should move the builder subproject into a so-called buildSrc project: see detailed description in following guides:

https://guides.gradle.org/writing-gradle-plugins/ https://docs.gradle.org/current/userguide/organizing_gradle_projects.html#sec:build_sources

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