Maven + AndroidAnnotations + Eclipse

时间:2016-01-10 18:15:58

标签: android eclipse maven android-annotations

我尝试将App(在Eclipse中开发)迁移到Maven,作为向前迈进Android Studio的一步。 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>de.xxx</groupId>
    <artifactId>sample</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>apk</packaging>
    <name>sample</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <platform.version> 4.1.1.4
        </platform.version>
        <android.plugin.version>3.8.2</android.plugin.version>
        <androidannotations.version>3.3.2</androidannotations.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>android</artifactId>
            <version>${platform.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.acra</groupId>
            <artifactId>acra</artifactId>
            <version>4.2.2RC</version>
        </dependency>
        <dependency>
            <groupId>com.actionbarsherlock</groupId>
            <artifactId>actionbarsherlock</artifactId>
            <version>4.4.0</version>
            <!-- <type>apklib</type> -->
        </dependency>
        <dependency>
            <groupId>org.androidannotations</groupId>
            <artifactId>androidannotations</artifactId>
            <version>${androidannotations.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.androidannotations</groupId>
            <artifactId>androidannotations-api</artifactId>
            <version>${androidannotations.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.android</groupId>
            <artifactId>support-v4</artifactId>
            <version>r7</version>
        </dependency>
        <dependency>
            <groupId>com.google.android.gms</groupId>
            <artifactId>google-play-services</artifactId>
            <version>29</version>
            <type>apklib</type>
        </dependency>
        <dependency>
            <groupId>com.google.maps.android</groupId>
            <artifactId>android-maps-utils</artifactId>
            <version>0.4</version>
        </dependency>
    </dependencies>
    <repositories>
        <repository>
            <id>acra-releases</id>
            <url>http://acra.googlecode.com/svn/repository/releases</url>
        </repository>
    </repositories>
    <build>
        <finalName>${project.artifactId}</finalName>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                                        <artifactId>android-maven-plugin</artifactId>
                                        <versionRange>[3.8.2,)</versionRange>
                                        <goals>
                                            <goal>generate-sources</goal>
                                            <goal>proguard</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <execute />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <version>3.8.2</version>
                <configuration>
                    <androidManifestFile>${project.basedir}/AndroidManifest.xml</androidManifestFile>
                    <assetsDirectory>${project.basedir}/assets</assetsDirectory>
                    <resourceDirectory>${project.basedir}/res</resourceDirectory>
                    <nativeLibrariesDirectory>${project.basedir}/src/main/native</nativeLibrariesDirectory>
                    <sdk>
                        <platform>23</platform>
                    </sdk>
                    <deleteConflictingFiles>true</deleteConflictingFiles>
                    <undeployBeforeDeploy>true</undeployBeforeDeploy>
                </configuration>
                <extensions>true</extensions>
            </plugin>
        <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                </configuration>
            </plugin>
         </plugins>
    </build>
</project>

Eclipse问题页面显示

    (com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.2:generate-sources:default-generate-sources:generate-sources)

Plugin execution not covered by lifecycle configuration: com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.2:consume-aar (execution: default-consume-aar, phase: compile)

以下不会生成AndroidAnnotation类。也许你可以指着我工作的pom.xml(Eclipse插件已经更新了)。

0 个答案:

没有答案