WorkspaceEntity (@NotNull MutableEntityStorage diff, @NotNull EntitySource source, @NotNull Project project) { WorkspaceEntity existingEntity = getExistingEntity(diff); if (existingEntity != null) return existingEntity; String renamedOutputFileName = this.myRenamedOutputFileName; String filePath = this.myFilePath; Objects.requireNonNull(filePath, "filePath is not specified"); FileCopyPackagingElementEntity addedEntity; VirtualFileUrlManager fileUrlManager = VirtualFileUrls.getVirtualFileUrlManager(project); VirtualFileUrl fileUrl = fileUrlManager.fromPath(filePath); if (renamedOutputFileName != null) { addedEntity = diff.addEntity(FileCopyPackagingElementEntity.create(fileUrl, source, entityBuilder -> { entityBuilder.setRenamedOutputFileName(renamedOutputFileName); return Unit.INSTANCE; })); } else { addedEntity = diff.addEntity(FileCopyPackagingElementEntity.create(fileUrl, source)); } diff.getMutableExternalMapping("intellij.artifacts.packaging.elements").addMapping(addedEntity, this); return addedEntity; }