Path createProjectForLinkedEdit(Project prj, List<String> arguments, boolean reload) throws IOException {
		Path originalFile = prj.getResourceRef().getFile();

		List<String> dependencies = prj.getMainSourceSet().getDependencies();
		String cp = BuildContext.forProject(prj).resolveClassPath().getClassPath();
		List<String> resolvedDependencies = Arrays.asList(cp.split(CP_SEPARATOR));

		Path baseDir = Settings.getCacheDir(Cache.CacheClass.projects);

		String name = originalFile.getFileName().toString();
		name = Util.unkebabify(name);

		Path tmpProjectDir = baseDir.resolve(name + "_jbang_" +
				Util.getStableID(originalFile.toAbsolutePath().toString()));
		Util.mkdirs(tmpProjectDir);
		tmpProjectDir = tmpProjectDir.resolve(stripPrefix(name));
		Util.mkdirs(tmpProjectDir);

		Path srcDir = tmpProjectDir.resolve("src");
		Util.mkdirs(srcDir);

		Path link = srcDir.resolve(name);
		Util.createLink(link, originalFile);

		for (ResourceRef sourceRef : prj.getMainSourceSet().getSources()) {
			Path linkFile;
			Source src = Source.forResourceRef(sourceRef, Function.identity());
			if (src.getJavaPackage().isPresent()) {
				Path packageDir = srcDir.resolve(src.getJavaPackage().get().replace(".", File.separator));
				Util.mkdirs(packageDir);
				linkFile = packageDir.resolve(sourceRef.getFile().getFileName());
			} else {
				linkFile = srcDir.resolve(sourceRef.getFile().getFileName());
			}
			Path destFile = sourceRef.getFile().toAbsolutePath();
			Util.createLink(linkFile, destFile);
		}

		for (RefTarget ref : prj.getMainSourceSet().getResources()) {
			Path linkFile = ref.to(srcDir);
			Util.mkdirs(linkFile.getParent());
			Util.createLink(linkFile, ref.getSource().getFile().toAbsolutePath());
		}

		// create build gradle
		Optional<String> packageName = Util.getSourcePackage(
				new String(Files.readAllBytes(link), Charset.defaultCharset()));
		String baseName = Util.getBaseName(name);
		String fullClassName;
		fullClassName = packageName.map(s -> s + "." + baseName).orElse(baseName);
		ResourceRef templateRef = ResourceRef.forResource("classpath:/build.qute.gradle");
		Path destination = tmpProjectDir.resolve("build.gradle");
		TemplateEngine engine = TemplateEngine.instance();

		// both collectDependencies and repositories are manipulated by
		// resolveDependencies
		List<MavenRepo> repositories = prj.getRepositories();
		if (repositories.isEmpty()) {
			prj.addRepository(DependencyUtil.toMavenRepo("central"));
		}

		// Turn any URL dependencies into regular GAV coordinates
		List<String> depIds = dependencies
			.stream()
			.map(JitPackUtil::ensureGAV)
			.collect(Collectors.toList());
		// And if we encountered URLs let's make sure the JitPack repo is available
		if (!depIds.equals(dependencies)
				&& repositories.stream().noneMatch(r -> DependencyUtil.REPO_JITPACK.equals(r.getUrl()))) {
			prj.addRepository(DependencyUtil.toMavenRepo(DependencyUtil.ALIAS_JITPACK));
		}

		renderTemplate(engine, depIds, fullClassName, baseName, resolvedDependencies, repositories,
				templateRef,
				arguments,
				destination);

		// setup eclipse
		templateRef = ResourceRef.forResource("classpath:/.qute.classpath");
		destination = tmpProjectDir.resolve(".classpath");
		renderTemplate(engine, dependencies, fullClassName, baseName, resolvedDependencies, repositories,
				templateRef,
				arguments,
				destination);

		templateRef = ResourceRef.forResource("classpath:/.qute.project");
		destination = tmpProjectDir.resolve(".project");
		renderTemplate(engine, dependencies, fullClassName, baseName, resolvedDependencies, repositories,
				templateRef,
				arguments,
				destination);

		templateRef = ResourceRef.forResource("classpath:/main.qute.launch");
		destination = tmpProjectDir.resolve(".eclipse/" + baseName + ".launch");
		destination.toFile().getParentFile().mkdirs();
		renderTemplate(engine, dependencies, fullClassName, baseName, resolvedDependencies, repositories,
				templateRef,
				arguments,
				destination);

		templateRef = ResourceRef.forResource("classpath:/main-port-4004.qute.launch");
		destination = tmpProjectDir.resolve(".eclipse/" + baseName + "-port-4004.launch");
		renderTemplate(engine, dependencies, fullClassName, baseName, resolvedDependencies, repositories,
				templateRef,
				arguments,
				destination);

		// setup vscode
		templateRef = ResourceRef.forResource("classpath:/launch.qute.json");
		destination = tmpProjectDir.resolve(".vscode/launch.json");
		if (isNeeded(reload, destination)) {
			destination.toFile().getParentFile().mkdirs();
			renderTemplate(engine, dependencies, fullClassName, baseName, resolvedDependencies, repositories,
					templateRef,
					arguments,
					destination);
		}

		// setup vscode
		templateRef = ResourceRef.forResource("classpath:/README.qute.md");
		destination = tmpProjectDir.resolve("README.md");
		if (isNeeded(reload, destination)) {
			destination.toFile().getParentFile().mkdirs();
			renderTemplate(engine, dependencies, fullClassName, baseName, resolvedDependencies, repositories,
					templateRef,
					arguments,
					destination);
		}

		templateRef = ResourceRef.forResource("classpath:/settings.qute.json");
		destination = tmpProjectDir.resolve(".vscode/settings.json");
		if (isNeeded(reload, destination)) {
			destination.toFile().getParentFile().mkdirs();
			renderTemplate(engine, dependencies, fullClassName, baseName, resolvedDependencies, repositories,
					templateRef,
					arguments,
					destination);
		}

		// setup intellij - disabled for now as idea was not picking these up directly
		/*
		 * templateName = "idea-port-4004.qute.xml"; destination = new
		 * File(tmpProjectDir, ".idea/runConfigurations/" + baseName +
		 * "-port-4004.xml").toPath(); destination.toFile().getParentFile().mkdirs();
		 * renderTemplate(engine, collectDependencies, baseName, resolvedDependencies,
		 * templateName, script.getArguments(), destination);
		 *
		 * templateName = "idea.qute.xml"; destination = new File(tmpProjectDir,
		 * ".idea/runConfigurations/" + baseName + ".xml").toPath();
		 * destination.toFile().getParentFile().mkdirs(); renderTemplate(engine,
		 * collectDependencies, baseName, resolvedDependencies, templateName,
		 * script.getArguments(), destination);
		 */

		return tmpProjectDir;
	}
Create Project to use for editing *
src/main/java/dev/jbang/cli/Edit.java