How to put maven project version in war file manifest?

前端 未结 3 1693
旧时难觅i
旧时难觅i 2021-02-02 10:29

I need to have Maven insert the version number from the POM file into the manifest located in the WAR file under /WEB-INF/manifest.mf.

How do I do this? I was able to ea

3条回答
  •  误落风尘
    2021-02-02 10:58

    Or you can use the addDefaultImplementationEntries or addDefaultSpecificationEntries flags which will add several entries including the project.version property.

    addDefaultImplementationEntries

    Implementation-Title: ${project.name}
    Implementation-Version: ${project.version}
    Implementation-Vendor-Id: ${project.groupId}
    Implementation-Vendor: ${project.organization.name}
    Implementation-URL: ${project.url}
    

    addDefaultSpecificationEntries

    Specification-Title: ${project.name}
    Specification-Version: ${project.version}
    Specification-Vendor: ${project.organization.name}
    

    Default value for both is false. If a property is not defined (e.g. project.organization.name), then that line will be excluded from the manifest.

    This could go into the maven-war-plugin configuration as follows:

    
        maven-war-plugin
        2.2
        
            
                
                    true
                
            
        
    
    

提交回复
热议问题