1

私はMavenを初めて使用し、pom.xmlの作成をほぼ完了しましたが、少し先に進むたびに別のエラーが発生します。今回は、このエラーは次のようになります。

  [INFO] ------------------------------------------------------------------------
[INFO] Building RecipeGrazer - App 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ NotepadAndroid ---
[INFO] Deleting /Users/username/Documents/notepad-pro/my-app-android/NotepadAndroid/target
[INFO] 
[INFO] --- android-maven-plugin:3.6.1:generate-sources (default-generate-sources) @ NotepadAndroid ---
[INFO] ANDROID-904-002: Found aidl files: Count = 1
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] Manifest merging disabled. Using project manifest only
[INFO] /Users/username/Desktop/sdk/build-tools/18.0.1/aapt [package, -m, -J, /Users/username/Documents/notepad-pro/my-app-android/NotepadAndroid/target/generated-sources/r, -M, /Users/username/Documents/notepad-pro/my-app-android/NotepadAndroid/AndroidManifest.xml, -S, /Users/username/Documents/notepad-pro/my-app-android/NotepadAndroid/res, --auto-add-overlay, -A, /Users/username/Documents/notepad-pro/my-app-android/NotepadAndroid/assets, -I, /Users/username/Desktop/sdk/platforms/android-10/android.jar]
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ NotepadAndroid ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Users/username/Documents/notepad-pro/my-app-android/NotepadAndroid/src/main/resources
[INFO] skip non existing resourceDirectory /Users/username/Documents/notepad-pro/my-app-android/NotepadAndroid/target/generated-sources/extracted-dependencies/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ NotepadAndroid ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 309 source files to /Users/username/Documents/notepad-pro/my-app-android/NotepadAndroid/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.899s
[INFO] Finished at: Thu Aug 22 12:25:43 CEST 2013
[INFO] Final Memory: 18M/367M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project NotepadAndroid: Fatal error compiling: invalid target release: 2.3.3 -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

どうしたの ?API を変更しましたが、同じエラーが発生します。

ここに私のpomの主要部分があります:

roperties>
        <environment>development</environment>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>2.3.3</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>support-v4</artifactId>
            <version>r7</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>20030203.000550</version>
        </dependency>
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.2.4</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>12.0.1</version>
        </dependency>
        <dependency>
            <groupId>com.google.inject</groupId>
            <artifactId>guice</artifactId>
            <version>2.0-no_aop</version>
        </dependency>
        <dependency>
            <groupId>com.google.http-client</groupId>
            <artifactId>google-http-client-android</artifactId>
            <version>1.16.0-rc</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpmime</artifactId>
            <version>4.2.5</version>
        </dependency>
        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
            <version>2.4.1</version>
        </dependency>
        <dependency>
            <groupId>org.roboguice</groupId>
            <artifactId>roboguice</artifactId>
            <version>2.0</version>
        </dependency>
        <dependency>
            <groupId>oauth.signpost</groupId>
            <artifactId>signpost-commonshttp4</artifactId>
            <version>1.2.1.1</version>
        </dependency>
        <dependency>
            <groupId>org.twitter4j</groupId>
            <artifactId>twitter4j-core</artifactId>
            <version>2.1.11</version>
        </dependency>

    </dependencies>

    <build>
        <sourceDirectory>src</sourceDirectory>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                    <source>2.3.3</source>
                    <target>2.3.3</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.6.1</version>
                <configuration>
                    <sdk>
                        <platform>10</platform>
                    </sdk>
                    <emulator>
                        <avd>22</avd>
                    </emulator>
                    <undeployBeforeDeploy>true</undeployBeforeDeploy>
                    <proguard>
                        <skip>false</skip>
                    </proguard>
                </configuration>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>
4

2 に答える 2

1

ビルドがmaven-compiler-plugin:compile目標で失敗するため、おそらくこれは次のとおりです。

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <encoding>UTF-8</encoding>
                <source>2.3.3</source>
                <target>2.3.3</target>
            </configuration>
        </plugin>

ソースとターゲットのバージョン パラメータは、 Android バージョンではなくJavaバージョン用です。つまり、代わりに次のようにする必要があります。

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <encoding>UTF-8</encoding>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>

-X(Maven自体が示唆しているように)パラメーターを使用してビルドを実行すると、その効果に関する情報が得られると思います。

于 2013-08-22T13:39:21.023 に答える