maven - read version number from property file

前端 未结 4 356
自闭症患者
自闭症患者 2020-12-19 00:56

I`m trying to read my build version number from a text file, and then assign it to the generated package name: myRelease-1.1.1.apk where the build number is manually set int

4条回答
  •  囚心锁ツ
    2020-12-19 01:16

    As you already got pom.xml, you don't need another extra properties file for define such a simple property, use POM's properties tag and override the default build finalName:

    
      1.1.1
    
    
      ... ...
      ${project.artifactId}-${final.build.version}
      ... ...
    
    

    If you use maven sign and zipalign your final apk at release stage, and want to override the final name here, use:

    
      
        
          com.jayway.maven.plugins.android.generation2
          android-maven-plugin
          true
          true
          
            true
            
              false
            
            
              true
              ${project.build.directory}/${project.artifactId}-${final.build.version}.apk
              ${project.build.directory}/${project.artifactId}-${final.build.version}-signed-aligned.apk
            
            
              
                
                  alignApk
                  package
                  
                    zipalign
                  
                
              
          
       
    
    

    EDIT:
    If you have to use properties file, use properties-maven-plugin, check out similar SO question here.

    Hope this help.

提交回复
热议问题