简体   繁体   English

Maven Android插件和库项目

[英]Maven Android Plugin And Library Projects

I have created an android application using maven-android-plugin, I want to use Android-ViewPagerIndicator and I've added dependency in the pom.xml. 我使用maven-android-plugin创建了一个android应用程序,我想使用Android-ViewPagerIndicator,并在pom.xml中添加了依赖项。

<dependency>
  <groupId>com.viewpagerindicator</groupId>
  <artifactId>library</artifactId>
  <version>2.4.1</version>
  <type>apklib</type>
</dependency>

But my android application is giving compile errors if I use the classes from Android-ViewPagerIndicator. 但是,如果我使用Android-ViewPagerIndicator中的类,则我的android应用程序会给出编译错误。

TitlePageIndicator cannot be resolved to a type

I'm getting above error in eclipse. 我正在克服日食中的错误。

Do I still need to download the library, import it to eclipse and reference it in the eclipse? 我仍然需要下载该库,将其导入Eclipse并在Eclipse中引用它吗?

(Sorry if this is a stupid question, since this is my first Android-Maven Project) (抱歉,这是一个愚蠢的问题,因为这是我的第一个Android-Maven项目)

Eclipse's configuration ought to be changed in order to use the installed Maven, and its repository and settings instead of the embedded one. 为了使用已安装的Maven及其存储库和设置,而不是嵌入式Maven,应该更改Eclipse的配置。 Go to "Window -> Preferences -> Maven -> Installations", add externally installed Maven to the list, and select it. 转到“窗口->首选项-> Maven->安装”,将外部安装的Maven添加到列表中,然后选择它。

After this, right click on the Maven project -> Maven -> Update Project. 之后,右键单击Maven项目-> Maven->更新项目。 Click "Select All" (right side) and make sure all options at the bottom of the dialog box are selected except "Offline". 单击“全选”(右侧),并确保选择了对话框底部的所有选项(“脱机”除外)。 This should refresh your workspace with dependencies from your local Maven's repository. 这应该使用本地Maven信息库中的依赖关系刷新工作空间。

The trick is to configure/convert each library project to a Maven project as well. 技巧是将每个库项目都配置/转换为Maven项目。 Once you do that your pom should have no trouble finding it. 一旦这样做,您的pom应该不会有任何麻烦。

Additionally, when you build using Maven.. first build each library project (mvn clean install) and then build the main solution. 此外,在使用Maven进行构建时,请首先构建每个库项目(mvn全新安装),然后构建主要解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM