[英]Convert android library project to maven artifact for use in intellij idea
I am using Maven for dependency management in my android projects and its great. 我在我的android项目中使用Maven进行依赖管理,这很棒。
I want to use a 3rd party android library project ( https://github.com/emilsjolander/StickyListHeaders ) and rather than download the directory and add the dependency manually I want to change the StickyListHeaders project into a maven project (an apklib?). 我想使用第三方android库项目( https://github.com/emilsjolander/StickyListHeaders )而不是下载目录并手动添加依赖项我想将StickyListHeaders项目更改为maven项目(apklib?) 。
This project already has a pom.xml
, so to create the artifact you only have to do a mvn package
. 这个项目已经有了一个
pom.xml
,所以要创建工件,你只需要做一个mvn package
。
Here there is a detailed explanation of how to publish in Maven Central Respository. 这里有一个如何在Maven Central Respository中发布的详细说明。
When I have to use a non-maven library in my Maven projects I use a "folder repository" . 当我必须在我的Maven项目中使用非maven库时,我使用“文件夹存储库” 。 By "folder respository" I mean that I use one folder of my project (
lib
or repo
sometimes) as a local repository. 通过“文件夹存储库”我的意思是我使用我的项目的一个文件夹(有时是
lib
或repo
)作为本地存储库。
For this you have to config a repository like that: 为此,您必须配置这样的存储库:
<repository>
<id>project</id>
<name>Project Maven Repository</name>
<layout>default</layout>
<url>file://${project.basedir}/lib</url>
</repository>
And then you can deploy the artifact into your local repository as this: 然后,您可以将工件部署到本地存储库中,如下所示:
mvn install:install-file -Dfile=path-to-your-artifact-jar \
-DgroupId=your.groupId \
-DartifactId=your-artifactId \
-Dversion=version \
-Dpackaging=jar \
-DlocalRepositoryPath=path-to-specific-local-repo
Tip: When my project has multiple maven modules, then I use file://${project.basedir}/../lib
as a repository url
. 提示:当我的项目有多个maven模块时,我使用
file://${project.basedir}/../lib
作为存储库url
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.