xolstice / protobuf-maven-plugin

Maven Plugin that executes the Protocol Buffers (protoc) compiler
https://www.xolstice.org/protobuf-maven-plugin/
Other
232 stars 76 forks source link

error "The process cannot access the file because it is being used by another process" #30

Closed jorgheymans closed 6 years ago

jorgheymans commented 6 years ago

Hi,

We are seeing this error sporadically in our builds

14:24:11 [ERROR] Failed to execute goal org.xolstice.maven.plugins:protobuf-maven-plugin:0.5.0:compile-custom (default) on project sdk: Unable to copy the file to c:\RC\Jenkins\workspace\sdk\shared\target\protoc-plugins: c:\RC\Jenkins\workspace\sdk\shared\target\protoc-plugins\protoc-3.1.0-windows-x86_64.exe (The process cannot access the file because it is being used by another process) -> [Help 1]

it does not happen all the time, and often a subsequent build will work fine but it's a bit annoying as you can understand.

the plugin is configured as such:

  <build>
    <extensions>
      <extension>
        <groupId>kr.motd.maven</groupId>
        <artifactId>os-maven-plugin</artifactId>
        <version>1.5.0.Final</version>
      </extension>
    </extensions>
    <plugins>
      <plugin>
        <groupId>org.xolstice.maven.plugins</groupId>
        <artifactId>protobuf-maven-plugin</artifactId>
        <version>0.5.0</version>
        <configuration>
          <protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}</protocArtifact>
          <pluginId>grpc-java</pluginId>
          <pluginArtifact>io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}
          </pluginArtifact>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>compile</goal>
              <goal>compile-custom</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
sergei-ivanov commented 6 years ago

I believe I have seen it a couple of times too and I suspect it is because of a virus scanner under Windows holding on to the file. However, I have an idea how to improve things when multiple plugin goals are being run in a sequence. I'll post an update when the new version is ready.

jorgheymans commented 6 years ago

great thanks !

On Wed, Jul 19, 2017 at 1:38 AM Sergei Ivanov notifications@github.com wrote:

I believe I have seen it a couple of times too and I suspect it is because of a virus scanner under Windows holding on to the file. However, I have an idea how to improve things when multiple plugin goals are being run in a sequence. I'll post an update when the new version is ready.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/xolstice/protobuf-maven-plugin/issues/30#issuecomment-316228567, or mute the thread https://github.com/notifications/unsubscribe-auth/AAL1AAiJdmn4rZSyDb2La_8_LinToSkaks5sPUIAgaJpZM4OX78z .

clevertension commented 6 years ago

do it resolved now? i meet this issue too, when i open the IDE(eclipse, intellij idea), it will always complain this during maven cli build

sergei-ivanov commented 6 years ago

I have committed a small change that I hope will fix the problem. Unfortunately, I cannot reproduce the problem on my current system, so I cannot tell if it's been fixed. Please give version 0.5.1 a try (I can see it's already been synced to Maven central).

jorgheymans commented 6 years ago

FYI haven't had the error for a good while now across our environments, so it seems that your fix did the trick thanks !