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

Protobuf-maven-plugin error #21

Closed
gaurav9822 opened this Issue Dec 7, 2016 · 13 comments

Comments

5 participants
@gaurav9822
Copy link

gaurav9822 commented Dec 7, 2016

Hi,

I am getting following error in Protobuf-maven-plugin:

[ERROR]Failed to execute goal org.xolstice.maven.plugins:protobuf-maven-plugin:0.5.0:compile-custom(default) on project : Unable to copy the file to D:\codebase\api\target\protoc-plugins: D:\codebase\api\target\protoc-plugins\protoc-3.0.2-windows-x86_64.exe
(The process cannot access the file because it is being used by another process)

What I've tried:-

I tried using toolchain but no help.
Also,disabled antivirus if its accessing it.
But still no luck.
Please help me with this issue.

Thanks,

Gaurav

@sergei-ivanov

This comment has been minimized.

Copy link
Member

sergei-ivanov commented Dec 7, 2016

Hi,

It looks like the plugin is trying to copy the file onto itself, which is weird.
Can you please provide more information as described here:
https://www.xolstice.org/protobuf-maven-plugin/contributions.html#Reporting_bugs
If it is a public project, please provide a link to it, othewise please upload a sanitised version of the POM as a gist.

Thanks

@gaurav9822

This comment has been minimized.

Copy link

gaurav9822 commented Dec 7, 2016

@sergei-ivanov

This comment has been minimized.

Copy link
Member

sergei-ivanov commented Dec 7, 2016

Does the plugin section in your root POM reside inside plugins or pluginManagement?
Can you try placing the two goals into two separate executions?
And you'll probably need to set clearOutputDirectory property to false in the configuration section.

@gaurav9822

This comment has been minimized.

Copy link

gaurav9822 commented Dec 8, 2016

@gaurav9822

This comment has been minimized.

Copy link

gaurav9822 commented Dec 8, 2016

@sergei-ivanov

This comment has been minimized.

Copy link
Member

sergei-ivanov commented Dec 8, 2016

Hello Gaurav,

Is it an error that is produced by protoc or by javac ? It is difficult to tell, because you are not providing enough context.
Either way, most likely you have an incorrect import statement (without a package name) somewhere in your code.

Sergei

@gaurav9822

This comment has been minimized.

Copy link

gaurav9822 commented Dec 9, 2016

Hi Sergei,

I resolved the error of compilation problem by including compile-custom goal in the root pom.xml

Ignore it,now the new error is popping by protoc is:-

[ERROR]Failed to execute goal org.xolstice.maven.plugins:protobuf-maven-plugin:0.5.0:compile-custom(default) on project : Unable to copy the file to D:\codebase\api\target\protoc-plugins: D:\codebase\api\target\protoc-plugins\protoc-gen-grpc-java-1.0.2-windows-x86_64.exe
(The process cannot access the file because it is being used by another process)

@sergei-ivanov

This comment has been minimized.

Copy link
Member

sergei-ivanov commented Dec 9, 2016

Can you please upload a small sample project that exhibits this behaviour to GitHub? Without a reproducible example I will struggle to help you. You will need to provide more context to your error report, the above does not allow to even try to guess the root cause. The complete log file would be helpful, not just the error line. Please use gists to upload larger/longer file fragments and post references here, instead of posting inline.

@taoyouxian

This comment has been minimized.

Copy link

taoyouxian commented Aug 22, 2017

I have also meet this problem, and my OS is Windows(the project in ubuntu is okay).
What is more? You can use protobuf Plugins in Maven where "View->Tool Windows->Maven Projects in IDEA IntelliJ" to compile, the fault will not appear.

@Archimechanical

This comment has been minimized.

Copy link

Archimechanical commented Sep 27, 2017

Same problem when forking spring-boot-maven-plugin (windows):

<plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
				<fork>true</fork>
				<arguments>
					<argument>-Dfile.encoding=UTF8</argument>
				</arguments>
				<jvmArguments>-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8002
					-Dfile.encoding=UTF8</jvmArguments>
			</configuration>
</plugin>

Setting fork to false working well.

@gaurav9822 gaurav9822 closed this Nov 2, 2017

@sergei-ivanov

This comment has been minimized.

Copy link
Member

sergei-ivanov commented Nov 3, 2017

@gaurav9822 has it been fixed by #30 or #34 in the latest version?
I'd like to have some feedback.

@Sewq

This comment has been minimized.

Copy link

Sewq commented Nov 12, 2017

I've got the same issue. Whats more - i cannot even copy the file from 'compile-custom' goal (protoc-gen-grpc-java-1.5.0-windows-x86_64) to my target/protoc-plugins/ folder by hand. Somehow i can do it when i change the name from "protoc-gen-grpc-java-1.5.0-windows-x86_64" to anything else. Im not sure if this file is blocked by windows or any anti-virus.
When i've changed the plugin to add another folder in protoc-plugin directory, and copy the .exe there, it works, but then i've got 'access denied' when trying to execute "--grpc-java_out: protoc-gen-grpc-java".

Weird stuff

@sergei-ivanov

This comment has been minimized.

Copy link
Member

sergei-ivanov commented Nov 13, 2017

@Sewq It's difficult to get to the root cause of this problem, especially that I cannot reproduce it myself. In my experience, some antivirus tools may employ very aggressive file locking, and there is no way around that unless you exclude both local maven repository and your project from virus scanning. Also, you may try using Process Explorer to locate the process that holds a lock on the file. If you are saying that you cannot even move the file manually, then some process must be holding on to it. If you can detect which process it is, it will help us all to understand the problem better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment