Open pierralex opened 5 years ago
Please, try to check you permissions on the given folder. I think this have nothing to do with the plugin but with access rights. Also, the full and exact error message would help here if that's not the permission problem.
@margru I am also getting same error. It works for files under resources : project.set_property("smart_copy_resources", { "src/main/resources/*.json": "${dir_dist}/resources" })
but if we specify key as "src/main/resources/" it gives permission issue. project.set_property("smart_copy_resources", { "src/main/resources/": "${dir_dist}/resources" }) here is the error message and log:
Executing subtask from pybuilder_smart_copy_resources Copying additional resource files Copying resource c:\work\xxx\xxx\src/main/resources\xxxxxx to C:\work\xx\xxxx\target\dist\lxxxxxx-1.0\resources\xxxxxxxx Traceback (most recent call last): File "c:\users\xxxxxx\appdata\local\programs\python\python36\lib\site-packages\pybuilder\cli.py", line 413, in main environments=options.environments, tasks=arguments) File "c:\users\xxxxxx\appdata\local\programs\python\python36\lib\site-packages\pybuilder\reactor.py", line 128, in build return self.build_execution_plan(tasks, execution_plan) File "c:\users\xxxxxx\appdata\local\programs\python\python36\lib\site-packages\pybuilder\reactor.py", line 166, in build_execution_plan reactor=self) File "c:\users\xxxxxx\appdata\local\programs\python\python36\lib\site-packages\pybuilder\execution.py", line 351, in execute_execution_plan summaries.append(self.execute_task(task, *keyword_arguments)) File "c:\users\xxxxxx\appdata\local\programs\python\python36\lib\site-packages\pybuilder\execution.py", line 298, in execute_task task.execute(self.logger, keyword_arguments) File "c:\users\xxxxxx\appdata\local\programs\python\python36\lib\site-packages\pybuilder\execution.py", line 169, in execute executable.execute(argument_dict) File "c:\users\xxxxxx\appdata\local\programs\python\python36\lib\site-packages\pybuilder\execution.py", line 100, in execute self.callable(arguments) File "c:\users\xxxxxx\appdata\local\programs\python\python36\lib\site-packages\pybuilder_smart_copy_resources__init.py", line 74, in package smart_copy_resource(file_to_copy, os.path.basename(file_to_copy) if copy_as is None else copy_as, destination, logger, verbose=project.get_property("verbose")) File "c:\users\xxxxxx\appdata\local\programs\python\python36\lib\site-packages\pybuilder_smart_copy_resources\init__.py", line 83, in smart_copy_resource shutil.copy(absolute_filename, absolute_target_file_name) File "c:\users\xxxxxx\appdata\local\programs\python\python36\lib\shutil.py", line 235, in copy copyfile(src, dst, follow_symlinks=follow_symlinks) File "c:\users\xxxxxx\appdata\local\programs\python\python36\lib\shutil.py", line 114, in copyfile with open(src, 'rb') as fsrc: PermissionError: [Errno 13] Permission denied: 'c:\work\xxxxxx\xxxxxx\src/main/resources\xxxxxx'
BUILD FAILED - [Errno 13] Permission denied: 'c:\work\xxxxxx\xxxxxx\src/main/resources\xxxxxx
@farooqind Have you tried to use the correct path separator (as you are obviously on Windows)?
@pierralex @farooqind Have you tried a glob
pattern, e.g. src/main/resources/*/ ?
Thanks for quick response @margru I tried glob pattern you suggested and it copies all files from subfolders to single folder in dir_dist. Our requirement is to copy whole directory structure & its files i.e. contents of src/main/resources to dir_dist. Is there anyway to do it?
This is what I want to copy from src/main to dir_dist
resources
@farooqind @pierralex OK, there is a bug in the code when copying the resources. Not sure when I have some time to fix that but I will keep it in mind and try to do it ASAP. Anyway, pull request is welcome.
@margru Is it possible to fix this anytime soon? I am in middle of a sprint and we may need to stop using pybuilder itself if this doesn't work.
Given the following build.py:
Build fails with "Access is denied" because src/main/resources contains lang/test.txt. Build succeeds if i do
My real use case is to have many files and directories under src/main/resources and all of them must be copied in my distribution. So the latest code snipet is not a solution for me.