Keep permissions on files with Maven resources:testResources

后端 未结 3 1099
被撕碎了的回忆
被撕碎了的回忆 2020-12-29 20:56

Is it possible to keep permissions on file with Maven resources:testResources? My use case is a Selenium binary driver that I put in /src/test/resources that I would like to

3条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-29 21:46

    I added a profile that gets activated automatically when run on a Unix machine. It executes an in-line shell script to adopt file permissions from all files in a folder recursively to files of the same name in another folder (see SRC and DST variables). The script requires a /bin/sh as well as find, xargs and chmod, which should exist on all modern systems.

        
            unix
            
                
                    unix
                
            
            
                
                    
                        org.codehaus.mojo
                        exec-maven-plugin
                        
                            
                                fix-resource-permissions
                                
                                    exec
                                
                                process-test-resources
                                
                                    /bin/sh
                                    
                                        -c
                                        
                                            set -x
    
                                            SRC="${basedir}/src/test/resources"
                                            DST="${project.build.directory}/test-classes"
    
                                            find "$$SRC" -printf "%P\0" | xargs --verbose -0 -I {} chmod --reference="$$SRC/{}" -f "$$DST/{}"
                                        
                                    
                                
                            
                        
                    
                
            
        
    

提交回复
热议问题