简体   繁体   English

如何将第 3 方本地 maven 存储库添加到 android 项目

[英]How to add a 3rd party local maven repository to android project

I have been provided an SDK to work on, which contains a maven-local-metadata file, an.aar file, .pom file and.jar file.我得到了一个 SDK 来处理,它包含一个 maven-local-metadata 文件、an.aar 文件、.pom 文件和.jar 文件。 How do I add this to my project.如何将其添加到我的项目中。 I tried pasting it to the local.m2 file but it didn't work (is there any specific way)and also adding as a new.aar/.jar module in the file option didn't work.我尝试将它粘贴到 local.m2 文件,但它不起作用(有什么特定的方法)并且在文件选项中添加为 new.aar/.jar 模块也不起作用。 any help would be greatly appreciated.任何帮助将不胜感激。

我的图书馆结构供参考

Create libs folder in your root directory then add your files there Check out the screenshot在根目录中创建 libs 文件夹,然后在其中添加文件 查看屏幕截图在此处输入图像描述

and then on BuildGradle (Project)然后在 BuildGradle (项目)

allprojects {
    repositories {
        google()
        jcenter()
        flatDir {
            dirs 'libs'
        }

    }
}

When pointing to dependencies that are residing within your system, you can create a lib folder and copy/move the jar files, but make sure to specify the location of the jar files in the pom.xml当指向驻留在系统中的依赖项时,您可以创建一个 lib 文件夹并复制/移动 jar 文件,但请确保在 pom.Z0F635D0E0F3874FFF8AB58C61 中指定 jar 文件的位置

<dependency>
   <groupId>com.some.group</groupId>
   <artifactId>jar-name</artifactId>
   <version>1.0</version>
   <scope>system</scope>
   <systemPath>${basedir}/lib/yourJar.jar</systemPath>
</dependency>

Just add the files in the local.m2 repository in the correct structure and youre good.只需以正确的结构添加 local.m2 存储库中的文件,就可以了。 no need to add in the libs folder.无需添加到 libs 文件夹中。

Note - If working with.aar files just as a modules注意 - 如果将 .aar 文件作为模块使用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在Maven根存储库中部署第3方jars? - How to deploy 3rd party jars in maven root repository? 如何在 Maven POM 中处理 3rd 方 JAR 和远程存储库? - How to handle 3rd party JARs and remote repository in Maven POM? 在Maven中使用第3方项目作为依赖项 - Using 3rd party project as dependency in Maven 在不能添加本地Maven回购的情况下,如何在Maven项目(编译,构建,打包)中包含第3方jars? - How include 3rd party jars in maven project (compile, build, package) where adding local maven repo is not an option? 添加带有Maven软件包的3rd Party Jars - Add 3rd Party Jars with Maven Package MAVEN-添加第三方软件 - MAVEN - add 3rd party software 将第 3 方 jar 包含在 Maven 着色 jar 中,而不将其添加到本地存储库 - Having a 3rd party jar included in Maven shaded jar without adding it to local repository 不能放在任何存储库中的第3方jar与Maven项目一起使用 - 3rd party jar which can not be put in any repository works with maven project 将第三方依赖项部署到maven存储库的简便方法 - easy way to deploy 3rd party dependencies to a maven repository 如何为 Intellij 和/或 VS Code 添加依赖项/第三方 java 库到 Maven 中? - How do I add dependencies/3rd party java libraries into Maven for Intellij and/or VS Code?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM