当我在我正在使用的库项目上运行命令mvn clean install时,我从maven收到错误,说无法运行命令。当我运行命令时,它给了我一堆编译器错误,这些错误与maven正在使用android-9而不是在pom.xml和AndroidManifest.xml中指定的android-17进行编译相关
我真的可以用一些方向。感谢
用于BoD / android-switch-backport的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>
<!-- Needed to deploy to Maven Central. -->
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<!-- Informational stuff. -->
<groupId>org.jraf</groupId>
<artifactId>android-switch-backport</artifactId>
<version>1.1-SNAPSHOT</version>
<packaging>apklib</packaging>
<name>Android Switch Backport</name>
<description>
A backport of the Switch widget (http://developer.android.com/reference/android/widget/Switch.html)
that was introduced on Android 4.
This port works on Android 2.1+.
</description>
<url>https://github.com/BoD/android-switch-backport</url>
<licenses>
<license>
<name>Apache 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>git@github.com:BoD/android-switch-backport.git</url>
<connection>scm:git:git@github.com:BoD/android-switch-backport.git</connection>
<developerConnection>scm:git:git@github.com:BoD/android-switch-backport.git</developerConnection>
</scm>
<issueManagement>
<url>https://github.com/BoD/android-switch-backport/issues</url>
<system>GitHub Issues</system>
</issueManagement>
<developers>
<developer>
<id>BoD</id>
<name>Benoit 'BoD' Lubek</name>
<email>BoD@JRAF.org</email>
<url>http://JRAF.org</url>
<organization>JRAF.org</organization>
<organizationUrl>http://JRAF.org</organizationUrl>
<roles>
<role>developer</role>
</roles>
<timezone>+1</timezone>
<properties>
<picUrl>https://en.gravatar.com/userimage/4833932/c2a1aef7adad2526e299518b325c2787.png</picUrl>
</properties>
</developer>
</developers>
<!-- Actually useful stuff. -->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.2.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.5.0</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.4</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>package</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
答案 0 :(得分:2)
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.5.0</version>
<extensions>true</extensions>
<configuration>
<sdk>
<platform>17</platform> <!-- since you are dependent on 4.2.2 -->
</sdk>
<configuration>
</plugin>
一步一步的方法。
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<android.version>2.3.3</android.version>
<android.api.level>10</android.api.level>
</properties>
<dependencies>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${android.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<configuration>
<sdk>
<platform>${android.api.level}</platform>
</sdk>
<apk>
<metaIncludes>
<metaInclude>services/**</metaInclude>
</metaIncludes>
</apk>
</configuration>
</plugin>
请查看here了解详情。