Skip to content

Commit

Permalink
#30 An attempt to avoid "file being used by another process" situation
Browse files Browse the repository at this point in the history
  • Loading branch information
sergei-ivanov committed Oct 15, 2017
1 parent bf7bc21 commit 55de313
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,8 @@ abstract class AbstractProtocMojo extends AbstractMojo {
protected boolean includeDependenciesInDescriptorSet;

/**
* If {@code true} and {@code writeDescriptorSet} has been set, do not strip SourceCodeInfo
* from the FileDescriptorProto. This results in vastly larger descriptors that include information
* If {@code true} and {@code writeDescriptorSet} has been set, do not strip SourceCodeInfo
* from the FileDescriptorProto. This results in vastly larger descriptors that include information
* about the original location of each decl in the source file as well as surrounding comments.
*
* @since 0.4.4
Expand Down Expand Up @@ -983,6 +983,11 @@ protected File resolveBinaryArtifact(final Artifact artifact) throws MojoExecuti
targetFileName = sourceFileName;
}
final File targetFile = new File(protocPluginDirectory, targetFileName);
if (targetFile.exists()) {
// The file must have already been copied in a prior plugin execution/invocation
getLog().debug("Executable file already exists: " + targetFile.getAbsolutePath());
return targetFile;
}
try {
FileUtils.forceMkdir(protocPluginDirectory);
} catch (final IOException e) {
Expand Down

0 comments on commit 55de313

Please sign in to comment.