Ollie C
Ollie C

Reputation: 28519

How to Maven-ise an ActionBarSherlock project?

I have a Java Android project that builds fine in IntelliJ, but I want to have it build on a CI server running Jenkins (at Cloudbees). Rather than mess about with ant, it seemed sensible to use maven, to handle the ABS dependency. I created a simple pom to declare the dependency:

<?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>
  <parent>
    <groupId>com.myapp</groupId>
    <artifactId>android</artifactId>
    <version>1.0.0</version>
  </parent>
  <groupId>com.myapp</groupId>
  <artifactId>myapp</artifactId>
  <version>1.0.1-SNAPSHOT</version>
  <name>myapp</name>
  <packaging>pom</packaging>

  <properties>
    <android.version>4.2.1_r1</android.version>
    <android.sdk.platform>17</android.sdk.platform>
    <google.android.maps.version>17</google.android.maps.version>
  </properties>

  <dependencies>
    <dependency>
      <groupId>com.actionbarsherlock</groupId>
      <artifactId>actionbarsherlock</artifactId>
      <version>4.1.0</version>
      <type>apklib</type>
    </dependency>
  </dependencies>

</project>

When I run it on my local machine, I get this:

[ERROR]   The project com.myapp:myapp:1.0.1-SNAPSHOT (C:\...\myapp\pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM: Failure to find com.myapp:android:pom: 1.0.0 in http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced and 'parent.relativePath' points at wrong local POM @ line 4, column 11 -> [Help 2]

I've no idea what that means. Can anyone help me understand why it's failing, what this error means? If you have any tips on mavenising an ActionBarSherlock Android app to get it working on Jenkins/cloudbees I'd be most appreciative.

Upvotes: 1

Views: 488

Answers (1)

Mark O&#39;Connor
Mark O&#39;Connor

Reputation: 77991

It's possible to use the ivy plugin to integrate Maven with an ANT build.

The following task will pull down the "actionbarsherlock-4.2.0.apklib" file and add it (and it's dependencies) onto the ANT path "compile.path":

<ivy:cachepath pathid="compile.path">
    <dependency org="com.actionbarsherlock" name="actionbarsherlock" rev="4.2.0" conf="default"/>
</ivy:cachepath>

The reason why your Maven dependency doesn't work might be because the Maven module is using a packaging type of "apklib". This means the following might work instead:

<dependency>
  <groupId>com.actionbarsherlock</groupId>
  <artifactId>actionbarsherlock</artifactId>
  <version>4.2.0</version>
</dependency>

For more information see:

Upvotes: 1

Related Questions