maven support for android projects?

前端 未结 5 1053
面向向阳花
面向向阳花 2021-01-01 15:02

I want to start a project for Android but i really like to build it using Maven. Does Google provide support for Maven or plan to support it? It would be great if anybody kn

5条回答
  •  有刺的猬
    2021-01-01 15:45

    Here is what I did to add maven support to an existing android project in Eclipse. I installed the 'm2e' plugin via the Eclipse market place. Then I installed the 'm2e-android' plugin. At the moment it is called 'Android Configurator for M2E' in Eclipse market place. After installing the two plugins and restarting Eclipse, right click on an existing android project-->Configure-->Convert to Maven Project. Choose a unique group id and an artifact id for your project then click finish. Copy the following contents to the pom.xml of the project and replace all the existing contents. Change the value of the 'version' tag under 'dependencies' to the SDK version you are using. Also change the value of the 'platform' tag near the end of the file to the value of your platform. Do not forget to also change the groupId, artifactId and name of the xml.

    
    
        4.0.0
        org.myproject
        MyProject
        0.1.0-SNAPSHOT
        apk
        MyProject
    
        
            
                com.google.android
                android
                2.3.3
                provided
            
        
        
            ${project.artifactId}
            src
            
                
                    
                        com.jayway.maven.plugins.android.generation2
                        android-maven-plugin
                        3.3.0
                        true
                    
                
            
            
                
                    com.jayway.maven.plugins.android.generation2
                    android-maven-plugin
                    
                        
                            
                            10
                        
                    
                
            
        
    
    

    After that right click on the project-->Maven-->Update Project. If Eclipse is complaining about errors in the xml, you may want to install maven then run

    mvn clean install
    

    from the console in the folder that contains the pom.xml file.

提交回复
热议问题