android - compilation error when using maven apklib -
i create library project , packing
apklib
. in application added depedency:
<dependency> <groupid>com.ati</groupid> <artifactid>common-lib</artifactid> <version>0.0.1-snapshot</version> <type>apklib</type> </dependency>
i use lib in app project like: com.ati.common_lib.test.demo();
, use mvn clean install
. worked! if use import com.ati.common_lib;
, test.demo();
, mvn clean build
throw error
[error] failed execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project soci-news: compilation failure: compilation failure: [error] /data/work/workspace/soci-parent/soci-news/src/main/java/com/ati/soci_news/helloandroidactivity.java:[9,15] cannot find symbol [error] symbol : class common_lib [error] location: package com.ati [error] /data/work/workspace/soci-parent/soci-news/src/main/java/com/ati/soci_news/helloandroidactivity.java:[23,9] cannot find symbol [error] symbol : variable test [error] location: class com.ati.soci_news.helloandroidactivity [error] -> [help 1] [error] [error] see full stack trace of errors, re-run maven -e switch. [error] re-run maven using -x switch enable full debug logging. [error] [error] more information errors , possible solutions, please read following articles: [error] [help 1] http://cwiki.apache.org/confluence/display/maven/mojofailureexception [error] [error] after correcting problems, can resume build command [error] mvn <goals> -rf :soci-news
i using maven 3.0.5, eclipse "kepler version" m2e-android. library , app created m2e-android. doing wrong here?
update
my parent 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/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.ati</groupid> <artifactid>soci-parent</artifactid> <version>0.0.1-snapshot</version> <packaging>pom</packaging> <name>soci project parent</name> <modules> <module>common-lib</module> <module>soci-news</module> </modules> <properties> <project.build.sourceencoding>utf-8</project.build.sourceencoding> </properties> <dependencymanagement> <dependencies> <dependency> <groupid>com.google.android</groupid> <artifactid>android</artifactid> <version>2.2.1</version> </dependency> </dependencies> </dependencymanagement> <build> <pluginmanagement> <plugins> <plugin> <groupid>com.jayway.maven.plugins.android.generation2</groupid> <artifactid>android-maven-plugin</artifactid> <version>3.6.1</version> <configuration> <sdk> <platform>8</platform> </sdk> <undeploybeforedeploy>true</undeploybeforedeploy> </configuration> </plugin> </plugins> </pluginmanagement> </build> </project>
my library 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> <parent> <groupid>com.ati</groupid> <artifactid>soci-parent</artifactid> <version>0.0.1-snapshot</version> </parent> <groupid>com.ati</groupid> <artifactid>common-lib</artifactid> <version>0.0.1-snapshot</version> <packaging>apklib</packaging> <name>common lib ati android application</name> <properties> <project.build.sourceencoding>utf-8</project.build.sourceencoding> <platform.version> 2.2.1 </platform.version> <android.plugin.version>3.6.1</android.plugin.version> </properties> <dependencies> <dependency> <groupid>com.google.android</groupid> <artifactid>android</artifactid> <scope>provided</scope> </dependency> </dependencies> <build> <plugins> <plugin> <groupid>com.jayway.maven.plugins.android.generation2</groupid> <artifactid>android-maven-plugin</artifactid> <extensions>true</extensions> </plugin> </plugins> </build> </project>
my app's 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> <parent> <groupid>com.ati</groupid> <artifactid>soci-parent</artifactid> <version>0.0.1-snapshot</version> </parent> <groupid>com.ati</groupid> <artifactid>soci-news</artifactid> <version>0.0.1-snapshot</version> <packaging>apk</packaging> <name>soci-news</name> <dependencies> <dependency> <groupid>com.google.android</groupid> <artifactid>android</artifactid> <scope>provided</scope> </dependency> <dependency> <groupid>com.ati</groupid> <artifactid>common-lib</artifactid> <version>0.0.1-snapshot</version> <type>apklib</type> </dependency> </dependencies> <build> <plugins> <plugin> <groupid>com.jayway.maven.plugins.android.generation2</groupid> <artifactid>android-maven-plugin</artifactid> <extensions>true</extensions> </plugin> </plugins> </build> </project>
your import broken.
com.ati.common-lib
package, want import contents of package, com.ati.common-lib.*
, com.ati.common-lib.test
test class.
Comments
Post a Comment