The following snippet produces a nearest to the spec manifest I could make.
It makes Specification-Version contain only digits and dots and 
Implementation-Version have something like `git describe`.

    Implementation-Version: 1.0.0-SNAPSHOT-g9440aea
    Specification-Version: 1.0.0

I think this should be the ultimate configuration for maven plus git:

        <properties>
                <!-- GIT-DESCRIBE(1): The "g" prefix stands for "git" -->
                
<implementation.version>${project.version}-g${buildNumberShort}</implementation.version>
        </properties>
    ...

                        <plugin>
                                <artifactId>maven-jar-plugin</artifactId>
                                <configuration>
                                        <archive>
                                                <manifest>
                                                        
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
                                                        
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
                                                </manifest>
                                                <manifestEntries>
                                                        
<Scm-Revision>${buildNumber}</Scm-Revision>
                                                        
<Scm-Connection>${project.scm.connection}</Scm-Connection>
                                                        
<Specification-Version>${specification.version}</Specification-Version>
                                                        
<Implementation-Version>${implementation.version}</Implementation-Version>
                                                </manifestEntries>
                                        </archive>
                                </configuration>
                        </plugin>

                        <plugin>
                                <groupId>org.codehaus.mojo</groupId>
                                
<artifactId>buildnumber-maven-plugin</artifactId>
                                <executions>
                                        <execution>
                                                <phase>validate</phase>
                                                <goals>
                                                        <goal>create</goal>
                                                </goals>
                                        </execution>
                                </executions>
                                <configuration>
                                        
<revisionOnScmFailure>unknown</revisionOnScmFailure>
                                        <doCheck>false</doCheck>
                                        <doUpdate>false</doUpdate>
                                </configuration>
                        </plugin>

                        <plugin>
                                <groupId>org.codehaus.mojo</groupId>
                                
<artifactId>build-helper-maven-plugin</artifactId>
                                <executions>
                                        <execution>
                                                <id>regex-properties</id>
                                                <goals>
                                                        
<goal>regex-properties</goal>
                                                </goals>
                                                <configuration>
                                                        <regexPropertySettings>
                                                                
<regexPropertySetting>
                                                                        <!-- 
abbreviate git commit -->
                                                                        
<name>buildNumberShort</name>
                                                                        
<value>${buildNumber}</value>
                                                                        
<regex>^(.......).*$</regex>
                                                                        
<replacement>$1</replacement>
                                                                        
<failIfNoMatch>false</failIfNoMatch>
                                                                
</regexPropertySetting>
                                                                
<regexPropertySetting>
                                                                        <!-- 
https://docs.oracle.com/javase/7/docs/api/java/lang/Package.html#getSpecificationVersion()
 -->
                                                                        
<name>specification.version</name>
                                                                        
<value>${project.version}</value>
                                                                        
<regex>([0-9.]*).*</regex>
                                                                        
<replacement>$1</replacement>
                                                                        
<failIfNoMatch>true</failIfNoMatch>
                                                                
</regexPropertySetting>
                                                        </regexPropertySettings>
                                                </configuration>
                                        </execution>
                                </executions>
                        </plugin>





On 05.02.2018 20:47, Basin Ilya wrote:
> Hi.
> I noticed that commons-parent pom has this:
> 
> ${scmBranch}@r${buildNumber}; ${maven.build.timestamp}
> 
> and it is used as `Implementation-build:` jar manifest entry.
> 
> Is it a standard or a tradition? Is it for svn only? What about git?
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to