为什么 Maven 无法生成 gen-external-apklibs 目录


IntelliJ IDEA 中,使用 Maven 添加“apklib”类型的依赖时,正常情况下会生成 gen-external-apklibs 目录,并在其下生成依赖的源文件。但有时候却无法生成 gen-external-apklibs 目录,那是因为 pom.xml 文件缺少配置。在 pom.xml 文件中加入“<packaging>apk</packaging>”,并添加“android-maven-plugin”插件,即可解决此问题:

<?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>groupId</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<name>test</name>
<packaging>apk</packaging>

<dependencies>
<!–actionbarsherlock–>
<dependency>
<groupId>com.actionbarsherlock</groupId>
<artifactId>actionbarsherlock</artifactId>
<version>4.4.0</version>
<type>apklib</type>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.6.0</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>

 


前一篇:
后一篇:

发表评论