3

My trouble is here:

<plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>buildnumber-maven-plugin</artifactId>
                    <version>1.3</version>
                    <executions>
                        <execution>
                            <phase>validate</phase>
                            <goals>
                                <goal>create</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>                        
                        <doCheck>false</doCheck>
                        <doUpdate>false</doUpdate>
                    </configuration>
                </plugin>  
                <plugin>
                    <artifactId>maven-jar-plugin</artifactId>
                    <version>2.5</version>
                    <configuration>
                        <archive>
                            <manifest>
                                <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                            </manifest>
                            <manifestEntries>  
                                <Implementation-Title>${project.name}</Implementation-Title>                              
                                <Implementation-Version>${buildNumber}</Implementation-Version>                                    
                            </manifestEntries>
                         </archive>
                    </configuration>
                </plugin>

What I'd like to do is to get the build number in runtime through manifest properties. There are plenty of instructions on how to use buildnumber-maven-plugin but I don't have a clue why in my manifest ${buildNumber} variable is not resolved.

<scm> tag is present in POM. When building I see the following message:

Storing buildNumber: a391951e51a593c5267a77264938d982696ed65a at timestamp: 1426368059203

Still here is the result: Implementation-Version: ${buildNumber}

Any help is much appreciated. Thank you.

Andreas
  • 347
  • 2
  • 9
  • Can you add the SCM section of the pom? If that's incorrect, the plugin won't know how to extract the build number. And you don't need to add the `execution` by default the plugin will bind to the initialize phase. – Augusto Mar 14 '15 at 20:58
  • Thank you for the answer. The scm section is present. During the build I see it is getting the build number: Storing buildNumber: a391951e51a593c5267a77264938d982696ed65a at timestamp: 1426368059203 . Still the same ${buildNumber} is not resolved.. – Andreas Mar 14 '15 at 21:21
  • @andreas did you ever solve this? – Kevin Herron Nov 11 '16 at 15:48
  • 2
    Yes. I don't remember exactly how I did it (It has been 1 year since this post) but I'm sure buildnumber-maven-plugin should be declared in POM prior maven-jar-plugin and I updated to buildnumber-maven-plugin to version 1.4. Do not use maven-assembly-plugin. It works fine now. Implementation-Version: dbc56ca48e221a2d9985d4b3c4ca09d4d806f00a – Andreas Nov 15 '16 at 20:24

0 Answers0