Maven android build会给出编译时错误,就像它使用-target = 1.5构建一样

时间:2012-09-26 19:51:14

标签: android maven java jdk1.6 jdk1.5

在我的maven构建期间,我遇到了这样的错误:

[ERROR] /sandbox/mobile-apps/quickdroid/test/src/com/xxx/MyActivity.java:[14,21] java.util.LinkedHashMap.Entry在java.util.LinkedHashMap中拥有私有权限

我用一个类创建了一个简单的测试项目。此错误对应于此代码:

        LinkedHashMap.Entry<String, Object> test;

Intellij很好地编译了这段代码。如果我在intellij javac参数中更改-target = 1.5,那么我会得到相同的错误。在我的pom.xml下面,我已经指定了目标1.6并使用-X参数验证了maven正在获取此设置。为什么我会收到错误,好像它仍在编译目标1.5?

摘自maven -X输出:   1.6

[DEBUG](f)来源= 1.6 [DEBUG](f)staleMillis = 0 [DEBUG](f)目标= 1.6

[DEBUG]命令行选项: [DEBUG] -d / sandbox / mobile-apps / quickdroid / test / target / classes -classpath {...} -g -nowarn -target 1.6 -source 1.6

的pom.xml

<?xml version="1.0" encoding="UTF-8"?>

http://maven.apache.org/maven-v4_0_0.xsd“&GT;     4.0.0

<groupId>com.xxx.android</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>apk</packaging>
<name>test</name>

<dependencies>

    <dependency>
        <groupId>com.google.android</groupId>
        <artifactId>android</artifactId>
        <version>4.1.1.4</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.3.2</version>
            <extensions>true</extensions>
            <configuration>
                <sdk>
                    <!-- platform or api level (api level 4 = platform 1.6)-->
                    <platform>11</platform>
                </sdk>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.5.1</version>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
    </plugins>
</build>

0 个答案:

没有答案