首页 > 代码库 > Android maven的配置问题

Android maven的配置问题

我们下载svn上的android-maven项目,可能配置会报错如下:

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)

搜了很多解决方案,觉得这个方案最靠谱,如下:

首先在eclipse中点 windows-preference-maven-lifecycle mapping ,点击“open workspace ...mappings metdata”,然后编辑如下内容:

<?xml version="1.0" encoding="UTF-8"?>
<lifecycleMappingMetadata>
    <pluginExecutions>
   
        <pluginExecution>
            <pluginExecutionFilter>
                <groupId>com.jayway.maven.plugins.android.generation2</groupId>
                <artifactId>android-maven-plugin</artifactId>
                <goals>
                    <goal>compile</goal>
                    <goal>generate-sources</goal>
                    <goal>proguard</goal>
                    <goal>process-classes</goal>
                </goals>
                <versionRange>[3.5,)</versionRange>
            </pluginExecutionFilter>
            <action>
                <ignore />
            </action>
        </pluginExecution>
       
    </pluginExecutions>
</lifecycleMappingMetadata>

groupId 和 artifactId 的内容就是pom.xml报错的插件名字,而那组goals的内容,就是在报错信息中一段文本中,如phase: compile,那么就加一个<goal>compile></goal>,如果还有错误如phase:generate-sources,同理再加一个<goal> 然后保存在默认的工作空间的.../.metadata/.plugins/org.eclipse.m2e.core/lifecycle-mapping-metadata.xml最后点击“reload workspaces lifecycle mappings metdata”

 

 

Android maven的配置问题