Note that there are some explanatory texts on larger screens.

plurals
  1. POmaven - read version number from property file
    primarykey
    data
    text
    <p>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 into a property file version.number=1.1.1 How can I overload ${version.number} as set in pom.xml by the one in the property file?</p> <p>Edit: more details about the project . I use git to commit the property file and then Jenkins takes over and builds with Maven. I would like to end up with a build “myBuild-9.9.9.apk”. Right now I have “myBuild-1.1.2.apk” In extras/version.properties</p> <pre><code>project.version=9.9.9 </code></pre> <p>In pom.xml</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;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"&gt; &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt; &lt;parent&gt; ..... &lt;version&gt;1.1.2&lt;/version&gt; &lt;/parent&gt; &lt;groupId&gt;ca.lapresse.android&lt;/groupId&gt; &lt;artifactId&gt;lapresse-hockey-app&lt;/artifactId&gt; &lt;packaging&gt;apk&lt;/packaging&gt; &lt;name&gt;La Presse Hockey - App&lt;/name&gt; &lt;version&gt;1.1.2&lt;/version&gt; </code></pre> <p>…… It seems that <code>${project.artifactId}</code> takes the version number from <code>&lt;version&gt;&lt;/version&gt;</code> and it becomes 1.1.2. This should be reflected in <code>${project.version}</code>, which I’m trying to overload from the property file.</p> <pre><code>&lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;properties-maven-plugin&lt;/artifactId&gt; &lt;version&gt;1.0-alpha-2&lt;/version&gt; &lt;executions&gt; &lt;execution&gt; &lt;phase&gt;process-resources&lt;/phase&gt; &lt;goals&gt; &lt;goal&gt;read-project-properties&lt;/goal&gt; &lt;/goals&gt; &lt;configuration&gt; &lt;files&gt; &lt;file&gt;${project.basedir}/extras/version.properties&lt;/file&gt; &lt;/files&gt; &lt;/configuration&gt; &lt;/execution&gt; &lt;/executions&gt; &lt;/plugin&gt; </code></pre> <p>What am I doing wrong and what I am not doing at all? My understanding of Maven is very rudimentary (I come from an Ant background). </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload