0

Currently, I have been successfully developing many android applications and testing it directly in my phone using USB cable.

Right now, as the project getting bigger. I need to integrate our apps using Maven. I use Intellij version 12.1.4 as IDE.

Having look at various sources from google:

  1. https://code.google.com/p/maven-android-plugin/wiki/GettingStarted

  2. http://4thline.org/articles/Building%20Android%20applications%20with%20Maven%20and%20IntelliJ.html

  3. http://www.ashokgelal.com/2012/12/setting-up-intellij-idea-12-with-maven-actionbarsherlock-roboelectric-androidannotations/

As I successful compile and make a .apk file using my pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>co.company</groupId>
    <artifactId>XXX</artifactId>
    <version>1.0</version>
    <packaging>apk</packaging>
    <name>Bisnis Pejantan</name>

    <dependencies>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>4.1.1.4</version>
            <scope>provided</scope>
        </dependency>

    </dependencies>

    <build>

        <finalName>${project.artifactId}</finalName>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.6.1</version>
                <configuration>
                    <sdk>
                        <path>${env.ANDROID_HOME}</path>
                        <platform>14</platform>
                    </sdk>
                    <undeployBeforeDeploy>true</undeployBeforeDeploy>
                </configuration>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>

</project>

My next objective is, to be able to install .apk file into my phone. However, when I execute deploy command in Intellij UI.

I got error:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project XXX: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project XXX: Deployment failed: repository element was not specified in the POM inside distributionManagement element or in -DaltDeploymentRepository=id::layout::url parameter

As I swim to stackoverflow, I found these possible solutions below but, i didn't find any clear and neat solution/answer for my problem.

mvn android:deploy not working (despite success confirmation)

https://github.com/mosabua/maven-android-sdk-deployer

My questions:

  1. How to make Maven DEPLOY works smoothly installing automatically my andorid app and executing the app on my Intellij just like the run command? What does it differ with Install command?

  2. Why does my pom.xml ask for distributionManagement element?

Settings:

Windows 7 x64

Intellij version 12.1.4

Android SDK API level 18, 16.

Testing phone: Samsung Galaxy Note 2, android level 16.

Maven version 3.0.5

Android maven version 3.6.1

Community
  • 1
  • 1
rhzs
  • 516
  • 7
  • 24
  • 1
    `package` - creates your desired maven artifact (jar/war/etc) in your `maven_project(or maven_module, depending on your project structure)/target` `install` - takes the previously created package and puts in `~/.m2/repository` `deploy` - read the information from and tries to deploy from `~/.m2/repository` An example would be to deploy your artifact to nexus – Andrei Sfat Aug 29 '13 at 19:27
  • so to solve your problem, you'll need to add to your pom.xml. If you just want to create the artifact just run `mvn clean install` – Andrei Sfat Aug 29 '13 at 19:29
  • @AndreiSfat what will it be look like? what kind of url value I should put in? Edit: I am newbie in maven – rhzs Aug 29 '13 at 19:31
  • where do you want to upload your artifact? – Andrei Sfat Aug 29 '13 at 20:22

0 Answers0