Ris*_*are 6 android gradle aar maven-publish flutter
我正在开发一个 flutter 项目,并用它构建 aar。我可以按照 flutter 提供的说明将这个 aar 集成到我的本机 android 项目中。但我的问题是这个aar是本地集成的。我想通过 maven 发布这个 aar,以便团队成员可以轻松访问它。
publishing在年级任务的帮助下可以从本机库发布。但对于 flutter 库,我不确定我们应该做什么。所以,我需要这方面的帮助。
小智 5
我试图弄清楚同样的事情......我真的没有,但这是我走了多远:
\n它有点混乱,可能会被覆盖,但我能够通过将 maven-publish 内容添加到生成的项目 gradle 来发布到本地 Nexus 存储库,.android/Flutter/build.gradle该项目似乎负责构建库。
apply plugin: 'maven-publish'\n\n...\n\nafterEvaluate {\n publishing {\n repositories {\n maven {\n url = "http://10.2.0.210:8081/repository/maven-releases/"\n credentials{\n username "a"\n password "b"\n }\n }\n }\n\n publications {\n // Creates a Maven publication called "release".\n release(MavenPublication) {\n // Applies the component for the release build variant.\n from project.components.release\n\n // You can then customize attributes of the publication as shown below.\n groupId = 'com.example.myflutmod'\n artifactId = 'something_module'\n version = '0.1.0'\n }\n // Creates a Maven publication called \xe2\x80\x9cdebug\xe2\x80\x9d.\n debug(MavenPublication) {\n // Applies the component for the debug build variant.\n from project.components.debug\n\n groupId = 'com.example.myflutmod'\n artifactId = 'something_module'\n version = '0.1.0'\n }\n }\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n然后我做了
\nflutter build aar\n./gradlew -b .android/Flutter/build.gradle publish\nRun Code Online (Sandbox Code Playgroud)\n最后在主 Android 应用程序项目中添加相同的 Maven 存储库配置和类似的依赖项\nimplementation "com.example.myflutmod:something_module:0.1.0"
但它在上传中不包含“插件依赖项 aars”(就像我的例子中的 url_launcher 一样),因此应用程序没有构建。\n这可能很容易添加,尽管我没有查看它。
\n因此,我更深入地发现,在修改 flutter 工具时,通过将文件系统存储库替换为您的自定义存储库,可以很容易地上传它构建的所有 .aar。所以在aar_init_script.gradle你的flutter sdk安装下:
diff --git a/packages/flutter_tools/gradle/aar_init_script.gradle b/packages/flutter_tools/gradle/aar_init_script.gradle\nindex cc2bbe6f98..242ac61fb0 100644\n--- a/packages/flutter_tools/gradle/aar_init_script.gradle\n+++ b/packages/flutter_tools/gradle/aar_init_script.gradle\n@@ -37,7 +37,10 @@ void configureProject(Project project, String outputDir) {\n project.uploadArchives {\n repositories {\n mavenDeployer {\n- repository(url: "file://${outputDir}/outputs/repo")\n+ //repository(url: "file://${outputDir}/outputs/repo")\n+ repository(url: "http://10.2.0.210:8081/repository/maven-releases/") {\n+ authentication(userName: "a", password: "b")\n+ }\n }\n }\n }\nRun Code Online (Sandbox Code Playgroud)\n对于他们来说,添加一些属性或切换到构建命令以使其使用外部配置的存储库似乎相当简单。\n也许将来会有 PR。
\n但现在我更倾向于制作一个脚本,file://${outputDir}/outputs/repo在构建后“手动”上传任何内容。
| 归档时间: |
|
| 查看次数: |
2597 次 |
| 最近记录: |