1

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.

4

1 回答 1

1

可以使用ivy 插件将 Maven 与 ANT 构建集成。

以下任务将下拉“actionbarsherlock-4.2.0.apklib”文件并将其(及其依赖项)添加到 ANT 路径“compile.path”中:

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

您的 Maven 依赖项不起作用的原因可能是因为 Maven 模块使用了“apklib”的打包类型。这意味着以下可能会起作用:

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

有关更多信息,请参阅:

于 2012-12-04T21:37:40.040 回答