Manually attach main artifact if built by maven-assembly-plugin

前端 未结 2 1199
野趣味
野趣味 2021-02-15 13:38

I am having problems building a maven project. I have a requirement to produce deterministic jar files, which must be binary-consistent across different builds and vers

2条回答
  •  轮回少年
    2021-02-15 14:13

    In case you don't have a plugin to create and attach main artifact for you, there is a more generic solution with Groovy Maven plugin:

    
        org.codehaus.gmaven
        groovy-maven-plugin
        2.1
        
            
                set-main-artifact
                package
                
                    execute
                
                
                    
                        project.artifact.setFile(new File(project.build.directory, project.build.finalName + ".zip"))
                    
                
            
        
    
    

    Inspired by post https://stackoverflow.com/a/31513690/2053580 many thanks to https://stackoverflow.com/users/1314907/lukasz-guminski

提交回复
热议问题