Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7190767
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:35:10+00:00 2026-05-28T19:35:10+00:00

I have tried to use properties file to read properties to set those values

  • 0

I have tried to use properties file to read properties to set those values into apk while building using maven.

Pluging i have used
->>>>>>

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>properties-maven-plugin</artifactId>
            <version>1.0-alpha-1</version>
            <executions>
                <execution>
                    <phase>initialize</phase>
                    <goals>
                        <goal>read-project-properties</goal>
                    </goals>
                    <configuration>
                        <files>
                            <file>${basedir}/buildNumber.properties</file>
                        </files>
                    </configuration>
                </execution>
            </executions>
        </plugin>


<build>
    <sourceDirectory>src</sourceDirectory>
    <finalName>myapk.${majorversion}.${minor_version}.${patch_version}.${maven.build.timestamp}</finalName>

File: buildNumber.properties

major_version=01
minor_version=00
patch_version=00

This generating myapk.01.00.00.20120127-2010.jar but apk is myapk.${major_version}.a.${minor_version}.${patch_version}.20120127-2010.apk

Let me know what I am missing here..?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T19:35:11+00:00Added an answer on May 28, 2026 at 7:35 pm

    I don’t know the exact reason, but it looks like properties-maven-plugin can substitute the property value properly defined under properties tag in pom.xml, and maven can only recognize the properties name explicitly defined in pom.xml, the following pom works for me:

    <properties>
      <!-- use property name defined in your buildNumber.properties -->
      <external.build.version>${major_version}</external.build.version>
    </properties>
    
    ... ...
    
    <build>
      <sourceDirectory>src</sourceDirectory>
      <!-- use property name defined earlier in this pom.xml -->
      <finalName>myapk.${external.build.version}</finalName>
    
    ... ...
    

    EDIT:
    From my point of view, The predefined build lifecycle of maven is quite exclusive especially when integrating with other build tools like ADT, the pom version used for generating the apk is quite restricted, moreover, from the plugin documentation, current version of android-maven-plugin does not provide any configuration for customizing the final apk name during apk goal. A similar discussion was posted here end up with a not so perfect answer.

    As a last shot, android-maven-plugin provide options to customize the final apk name during zipalign goal:

    <plugin>
      <groupId>com.jayway.maven.plugins.android.generation2</groupId>
      <artifactId>android-maven-plugin</artifactId>
      <extensions>true</extensions>
      <configuration>
        <sdk>
          <platform>13</platform>
        </sdk>
        <undeployBeforeDeploy>true</undeployBeforeDeploy>
        <zipalign>
          <verbose>true</verbose>
          <inputApk>${project.build.directory}/${project.artifactId}-${project.version}.apk</inputApk>
          <!-- directly use property name defined in external properties file here -->
          <outputApk>${project.build.directory}/${project.artifactId}-${major_version}-aligned.apk</outputApk>
        </zipalign>
      </configuration>
      <executions>
        <execution>
          <id>alignApk</id>
          <phase>package</phase>
          <goals>
            <goal>zipalign</goal>
          </goals>
        </execution>
      </executions>
    </plugin>
    

    This could be a solution if you use maven zipalign your final apk (I suppose you do), you will get all three output files (.ap_ and .apk and .jar) end with the default ${project.version} plus another apk end with ${major_version}-aligned, however only those three with the default ${project.version} will get installed in the maven central repository.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use maven 3.0.3 and have tried to generate pom for third-party jar like
I have a Java application (non-web) which must read from a properties file. This
I have tried to use mysql fulltext search in my intranet. I wanted to
I have tried to use the following snippet of code: int main() { string
I have heard about JNI and have tried to use it. What I would
Have you tried to use SharePoint with version control such as Perforce (or Subversion),
I have to use oracle database in android. I have tried to work as
I want to use a variable in a string. I have tried to do
I have small library i want to use for creating games. First, i tried
Properties file location is WEB-INF/classes/auth.properties . I cannot use JSF-specific ways (with ExternalContext) because

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.