简体   繁体   English

将android库项目转换为maven工件,以便在intellij构思中使用

[英]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?) 。

  1. How do I create the maven artefact. 如何创建maven artefact。
  2. Is there anything I can commit back to github in order to allow the author to publish there project on maven central? 有什么我可以回馈给github以便让作者在maven central上发布那个项目吗?
  3. After creating the artefact, should I set up a local maven repo such as nexus in order to share the artefact with the team. 在创建了人工制品之后,我是否应该建立一个本地的maven repo,例如nexus,以便与团队分享人工制品。
  1. This project already has a pom.xml , so to create the artifact you only have to do a mvn package . 这个项目已经有了一个pom.xml ,所以要创建工件,你只需要做一个mvn package

  2. Here there is a detailed explanation of how to publish in Maven Central Respository. 这里有一个如何在Maven Central Respository中发布的详细说明。

  3. 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. 通过“文件夹存储库我的意思是我使用我的项目的一个文件夹(有时是librepo )作为本地存储库。

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM