问题描述
我使用的Eclipse 3.7.2 +安卓+的Maven + M2E,我有与Android库的问题包括通过Maven作为apklibs。我建立了一个测试场景,其中两个项目的 mvntest1 的(主体工程)和 mvntest2 的(我的库项目)。该的pom.xml
的包含该文本之后。
到目前为止好。我可以通过控制台 $ MVN安装
没有任何错误打造的 mvntest2 的。因此,我在我的本地仓库的apklib(〜/ .m2目录/资料库/ mvntest2 / mvntest2 / 0.0.1-SNAPSHOT / mvntest2-0.0.1-SNAPSHOT.apklib
)
不过:在包括不起作用。 Eclipse不包括班, mvntest2 的中的 mvntest1 的等。我已经清理,更新,配置和依赖性并没有什么帮助。
我是什么做错了吗?请帮忙。如果某些信息丢失,只问。
======= mvntest1 / pom.xml的=====
< XML版本=1.0编码=UTF-8&GT?;
<项目的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> mvntest1< /的groupId>
< artifactId的> mvntest1< / artifactId的>
<版> 0.0.1 - 快照 - LT; /版本>
<包装> APK< /包装>
<名称>&mvntest1 LT; /名称>
<依赖>
<依赖>
<的groupId> com.google.android< /的groupId>
< artifactId的>的android< / artifactId的>
<版> 2.1.2< /版本>
<范围>提供与LT; /范围>
< /依赖性>
<依赖>
<的groupId> mvntest2< /的groupId>
< artifactId的> mvntest2< / artifactId的>
<版> 0.0.1 - 快照 - LT; /版本>
<类型> apklib< /类型>
< /依赖性>
< /依赖性>
<建立>
< finalName> $ {project.artifactId}< / finalName>
< sourceDirectory> SRC< / sourceDirectory>
<插件>
<插件>
<的groupId> com.jayway.maven.plugins.android.generation2< /的groupId>
< artifactId的> Android的行家,插件和LT; / artifactId的>
<版> 3.0.0< /版本>
<结构>
&LT; androidManifestFile&GT; $ {project.basedir} /AndroidManifest.xml</androidManifestFile>
&LT; assetsDirectory&GT; $ {project.basedir} /资产&LT; / assetsDirectory&GT;
&LT; resourceDirectory&GT; $ {project.basedir} / RES&LT; / resourceDirectory&GT;
&LT; nativeLibrariesDirectory&GT; $ {project.basedir} / src目录/主/本地&LT; / nativeLibrariesDirectory&GT;
&LT; SDK&GT;
&LT;平台&GT; 7&LT; /平台&GT;
&LT; / SDK&GT;
&LT; deleteConflictingFiles&GT;真&LT; / deleteConflictingFiles&GT;
&LT; undeployBeforeDeploy&GT;真&LT; / undeployBeforeDeploy&GT;
&LT; /结构&gt;
&LT;扩展&GT;真&LT; /扩展&GT;
&LT; /插件&GT;
&LT;插件&GT;
&LT; artifactId的&GT; Maven的编译器插件&LT; / artifactId的&GT;
&LT;版&GT; 2.3.2&LT; /版本&GT;
&lt;结构&GT;
&lt;信源&GT; 1.6&LT; /源&GT;
&lt;目标&GT; 1.6&LT; /目标和GT;
&LT; /结构&gt;
&LT; /插件&GT;
&LT; /插件&GT;
&LT; /编译&GT;
== mvntest2 / pom.xml的=====
&LT; XML版本=1.0编码=UTF-8&GT?;
&LT;项目的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">
&LT; modelVersion&GT; 4.0.0&LT; / modelVersion&GT;
&LT;的groupId&GT; mvntest2&LT; /的groupId&GT;
&LT; artifactId的&GT; mvntest2&LT; / artifactId的&GT;
&LT;版&GT; 0.0.1 - 快照 - LT; /版本&GT;
&LT;包装&GT; apklib&LT; /包装&GT;
&LT;名称&gt;&mvntest2 LT; /名称&gt;
&LT;依赖&GT;
&LT;依赖&GT;
&LT;的groupId&GT; com.google.android&LT; /的groupId&GT;
&LT; artifactId的&GT;的android&LT; / artifactId的&GT;
&LT;版&GT; 2.1.2&LT; /版本&GT;
&LT;范围&GT;提供与LT; /范围&GT;
&LT; /依赖性&GT;
&LT; /依赖性&GT;
&LT;建立&GT;
&LT; finalName&GT; $ {project.artifactId}&LT; / finalName&GT;
&LT; sourceDirectory&GT; SRC&LT; / sourceDirectory&GT;
&LT;插件&GT;
&LT;插件&GT;
&LT;的groupId&GT; com.jayway.maven.plugins.android.generation2&LT; /的groupId&GT;
&LT; artifactId的&GT; Android的行家,插件和LT; / artifactId的&GT;
&LT;版&GT; 3.0.0&LT; /版本&GT;
&lt;结构&GT;
&LT; androidManifestFile&GT; $ {project.basedir} /AndroidManifest.xml</androidManifestFile>
&LT; assetsDirectory&GT; $ {project.basedir} /资产&LT; / assetsDirectory&GT;
&LT; resourceDirectory&GT; $ {project.basedir} / RES&LT; / resourceDirectory&GT;
&LT; nativeLibrariesDirectory&GT; $ {project.basedir} / src目录/主/本地&LT; / nativeLibrariesDirectory&GT;
&LT; SDK&GT;
&LT;平台&GT; 7&LT; /平台&GT;
&LT; / SDK&GT;
&LT; deleteConflictingFiles&GT;真&LT; / deleteConflictingFiles&GT;
&LT; undeployBeforeDeploy&GT;真&LT; / undeployBeforeDeploy&GT;
&LT; /结构&gt;
&LT;扩展&GT;真&LT; /扩展&GT;
&LT; /插件&GT;
&LT;插件&GT;
&LT; artifactId的&GT; Maven的编译器插件&LT; / artifactId的&GT;
&LT;版&GT; 2.3.2&LT; /版本&GT;
&lt;结构&GT;
&lt;信源&GT; 1.6&LT; /源&GT;
&lt;目标&GT; 1.6&LT; /目标和GT;
&LT; /结构&gt;
&LT; /插件&GT;
&LT; /插件&GT;
&LT; /编译&GT;
&LT; /项目&GT;
支持在ADT的Eclipse apklib依赖是正在进行的工作为的项目,尚未完成。请就这个问题发表评论我要保持更新:
https://github.com/rgladwell/m2e-android/issues/8
更新2013年9月26日:机器人连接器的Maven的Eclipse(M2E-机器人)0.4.3版本现在已经发布与Android的库全面支持
I am using Eclipse 3.7.2 + Android + Maven + m2e and I have a problem with Android libraries included via Maven as apklibs. I built a test scenario with two projects, mvntest1 (the main project) and mvntest2 (my library project). The pom.xml
's are included after this text.
So far so good. I can build mvntest2 via console $ mvn install
without any errors. Thus, I have an apklib in my local maven repository (~/.m2/repository/mvntest2/mvntest2/0.0.1-SNAPSHOT/mvntest2-0.0.1-SNAPSHOT.apklib
).
But: The including does not work. Eclipse does not include the classes, etc. of mvntest2 in mvntest1. I have cleaned, updated the configuration and dependencies and nothing help.
What am I doing wrong? Please help.If some informations are missing, just ask.
======= mvntest1/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>mvntest1</groupId>
<artifactId>mvntest1</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>apk</packaging>
<name>mvntest1</name>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>2.1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>mvntest2</groupId>
<artifactId>mvntest2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<type>apklib</type>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
<assetsDirectory>${project.basedir}/assets</assetsDirectory>
<resourceDirectory>${project.basedir}/res</resourceDirectory>
<nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
<sdk>
<platform>7</platform>
</sdk>
<deleteConflictingFiles>true</deleteConflictingFiles>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
</configuration>
<extensions>true</extensions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
====== mvntest2/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>mvntest2</groupId>
<artifactId>mvntest2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>apklib</packaging>
<name>mvntest2</name>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>2.1.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
<assetsDirectory>${project.basedir}/assets</assetsDirectory>
<resourceDirectory>${project.basedir}/res</resourceDirectory>
<nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
<sdk>
<platform>7</platform>
</sdk>
<deleteConflictingFiles>true</deleteConflictingFiles>
<undeployBeforeDeploy>true</undeployBeforeDeploy>
</configuration>
<extensions>true</extensions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Support for apklib dependencies in ADT Eclipse is part of ongoing work for the m2e-android project and is not yet complete. Please comment on this issue to stay updated:
https://github.com/rgladwell/m2e-android/issues/8
UPDATE 26th September 2013: Android Connector for Maven Eclipse (m2e-android) version 0.4.3 now has been released with full support for Android Libraries.
这篇关于如何使用Android的库(apklibs)与Maven和eclipse?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!