Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "permission denied" bug for multi-user systems #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -742,11 +742,14 @@ private MojoExecution getExecution(MavenExecutionPlan executionPlan, MojoExecuti
* Generates a temporary file in the system temporary folder for a given artifact
* @param localRepo the local repository used to compute the file path
* @param artifact the artifact to generate a temporary file for
* @return a temporary file sitting under ${"java.io.tmpdir"}/fakerepo/${groupid}/{artifactid}/${version}/
* @return a temporary file sitting under ${"java.io.tmpdir"}/fakerepo[_{"user.name"}]/${groupid}/{artifactid}/${version}/
* @throws IOException if the file could not be created
*/
private File fakeFile(ArtifactRepository localRepo, Artifact artifact) throws IOException {
File fakeRepo = new File(System.getProperty("java.io.tmpdir"), "fakerepo");
// The path to the fake repo should be unique for each user of a system
String userName = System.getProperty("user.name");
String subDirSuffix = (userName != null) ? ("_" + userName) : ("");
File fakeRepo = new File(System.getProperty("java.io.tmpdir"), "fakerepo" + subDirSuffix);

File fakeFile = new File(fakeRepo, localRepo.pathOf(artifact));
File parent = fakeFile.getParentFile();
Expand Down