Domanda

I am using Maven for dependency management in my android projects and its great.

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?).

  1. How do I create the 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?
  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.
È stato utile?

Soluzione

  1. This project already has a pom.xml, so to create the artifact you only have to do a mvn package.

  2. Here there is a detailed explanation of how to publish in Maven Central Respository.

  3. When I have to use a non-maven library in my Maven projects I use a "folder repository". By "folder respository" I mean that I use one folder of my project (lib or repo sometimes) as a local repository.

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top