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

关于plugins方式引入找不到插件的问题的解决方案 #27

Closed
wurensen opened this issue Sep 1, 2022 · 2 comments
Closed
Labels
documentation Improvements or additions to documentation

Comments

@wurensen
Copy link
Owner

wurensen commented Sep 1, 2022

原因:由于该插件并未发布到Gradle Plugin Portal,所以直接在plugins直接使用id会找不到
解决方案:自定义插件id解析策略
修改settings.gradle文件:

pluginManagement {
    resolutionStrategy {
        // 定义id和插件库映射关系
        def modules = [
                'android-aspectjx'       : 'io.github.wurensen:gradle-android-plugin-aspectjx:2.0.15,
        ]
        eachPlugin {
            println "id=" + requested.id.id
            def module = modules.get(requested.id.id)
            if (module != null) {
                useModule(module)
            }
        }
    }
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}

以上这种解法适用于所有还未发布到gradle官方插件仓库的插件。

发布到gradle官方插件仓库即将支持,届时会关闭该issue。

@wurensen wurensen added the documentation Improvements or additions to documentation label Sep 1, 2022
@wurensen wurensen pinned this issue Sep 1, 2022
@wurensen
Copy link
Owner Author

wurensen commented Sep 1, 2022

目前自测版本:AGP7.1.3,Gradle7.2

@wurensen
Copy link
Owner Author

wurensen commented Sep 8, 2022

3.0.0版本开始已同步发布到gradlePluginPortal

@wurensen wurensen closed this as completed Sep 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant