1

I've been trying to build an Android app using Fragments for almost two days and I'm using Maven. If I try to build my app Maven gives the following error:

[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Pontes Het Goese Lyceum 2.0
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.google.android:android:jar:2.2.1 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO] 
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ pontes ---
[INFO] Deleting C:\Users\Koen\Android\Apps\Pontes Het Goese Lyceum\target
[INFO] 
[INFO] --- android-maven-plugin:3.3.0:generate-sources (default-generate-sources) @ pontes ---
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] ANDROID-904-002: Found aidl files: Count = 0
[INFO] C:\android-sdk-windows\platform-tools\aapt.exe [package, -m, -J, C:\Users\Koen\Android\Apps\Pontes Het Goese Lyceum\target\generated-sources\r, -M, C:\Users\Koen\Android\Apps\Pontes Het Goese Lyceum\AndroidManifest.xml, -S, C:\Users\Koen\Android\Apps\Pontes Het Goese Lyceum\res, --auto-add-overlay, -A, C:\Users\Koen\Android\Apps\Pontes Het Goese Lyceum\assets, -I, C:\android-sdk-windows\platforms\android-8\android.jar]
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ pontes ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\Koen\Android\Apps\Pontes Het Goese Lyceum\src\main\resources
[INFO] skip non existing resourceDirectory C:\Users\Koen\Android\Apps\Pontes Het Goese Lyceum\target\generated-sources\extracted-dependencies\src\main\resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ pontes ---
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 11 source files to C:\Users\Koen\Android\Apps\Pontes Het Goese Lyceum\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] C:\Users\Koen\Android\Apps\Pontes Het Goese Lyceum\src\com\koenv\pontes\RoosterFragment.java:[13,24] error: cannot access XmlPullParser
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.928s
[INFO] Finished at: Sat Aug 18 14:36:21 CEST 2012
[INFO] Final Memory: 13M/247M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project pontes: Compilation failure
[ERROR] C:\Users\Koen\Android\Apps\Pontes Het Goese Lyceum\src\com\koenv\pontes\RoosterFragment.java:[13,24] error: cannot access XmlPullParser
[ERROR] -> [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/MojoFailureException

I'm using the following 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>
    <groupId>com.koenv</groupId>
    <artifactId>pontes</artifactId>
    <version>2.0</version>
    <packaging>apk</packaging>
    <name>Pontes Het Goese Lyceum</name>

    <dependencies>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>2.2.1</version>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>support-v4</artifactId>
            <version>r7</version>
        </dependency>

    </dependencies>
    <build>
        <finalName>${project.artifactId}</finalName>
        <sourceDirectory>src</sourceDirectory>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                    <artifactId>android-maven-plugin</artifactId>
                    <version>3.3.0</version>
                    <extensions>true</extensions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <configuration>
                    <sdk>
                        <!-- platform or api level (api level 4 = platform 1.6)-->
                        <platform>8</platform>
                    </sdk>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

And the file in which the error is detected is just a simple Fragment:

package com.koenv.pontes;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class RoosterFragment extends Fragment {
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

            return inflater.inflate(R.layout.mijn_rooster, container, false);
        }
}

What am I doing wrong, I'm using 'maven clean install' on Windows.

4

1 に答える 1

0

Maven の -X オプションを使用して答えを見つけました。致命的な行は次のとおりです。

[WARNING] The POM for com.google.android:android:jar:2.2.1 is invalid, transitive dependencies (if any) will not be available: 1 problem was encountered while building the effective model for com.google.android:android:2.2.1
[FATAL] Non-parseable POM C:\Users\Koen\.m2\repository\org\sonatype\oss\oss-parent\3\oss-parent-3.pom: entity reference names can not start with character '&' (position: START_TAG seen ...TagName(\'base\')[0], _bH = "http://forums.spout.org/";\n\t\t\tif (_b &&... @10:13)  @ C:\Users\Koen\.m2\repository\org\sonatype\oss\oss-parent\3\oss-parent-3.pom, line 10, column 13

.m2\repository\org\sonatype\oss\oss-parent\ を削除すると、すべてが再び機能し、Maven を使用してアプリを再度コンパイルできるようになりました。

于 2012-08-20T14:03:52.667 に答える