-
Notifications
You must be signed in to change notification settings - Fork 78
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
Errors in Eclipse #10
Comments
I'll start with the second issue. I think you may need to set clearOutputDirectory to As for the first problem, there's not enough information. I reckon it may have something to do with I am not using Eclipse myself, so any support for Eclipse integration will happen on a best effort basis, but let's see if we can make sense of the error with more information at hand. It could be some trivial config issue. |
Ok. I set clearOutputDirectory false. Because the error is intermittent, it may be a while before I know it worked. I'm using Eclipse Neon 4.6.0, which, so far as I know, is current. It's a plain vanilla install and uses the built-in m2e (Maven 2 Eclipse) plugin. I've attached the pom. It's a zip because github won't let me attach an xml file. |
I reckon the way M2E works, it actually invokes Maven on changes to the project, which causes the protobuf plugin to blitz the directory with generated sources and regenerate them from scratch each time. Suppressing I believe I have found the instructions that may help you overcome Eclipse integration problems: |
The os-maven-plugin seems to work ok without intervention. It's correctly detecting the os and setting the variables. I've opened and closed Eclipse multiple times and the problem has not reoccurred. Maybe clearOutputDirectory did the trick. I'll post again if it happens again. |
Please reopen this issue if the problem recurs. |
This problem is definitely still happening. It's intermittent. Has been happening when I first start Eclipse. Doing a full project build usually clears it, but not always. Sometimes happens when I add a new .proto file. |
Can you please clarify, which of the two problems are you referring to?
Can you post your current POM please (you can create a gist for that purpose, works better than attaching a zip file). |
It's actually neither problem. The ${os.detected.classifier} has always worked correctly, and it doesn't look like files are getting deleted. This morning I'm getting it to happen reliably if I simple edit a .proto file and save it. I get an error in Eclipse on the line in the pom that says "", line 50. The error message is the same as the one in my first comment. I've just discovered that it I simply edit and save the pom, the error goes away. Here's the pom: https://gist.github.com/ccleve/0f30a0d61ab1c0c495637b425679f413 |
Well, if you are getting Missing: ---------- 1) com.google.protobuf:protoc:exe:${os.detected.classifier}:3.0.0, then the problem is with the |
Yes, I have followed the instructions. I just upgraded to 1.5.0.Final: kr.motd.maven os-maven-plugin 1.5.0.Finaland I copied os-maven-plugin-1.5.0.Final.jar into the /eclipse/plugins directory and restarted Eclipse. Same behavior. |
I am still suspecting it is an Eclipse + Let's try a simple test. Let's add the following execution of <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>test-copy-protoc</id>
<phase>generate-sources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.google.protobuf</groupId>
<artifactId>protoc</artifactId>
<version>3.0.0</version>
<type>exe</type>
<classifier>${os.detected.classifier}</classifier>
<overWrite>true</overWrite>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin> |
Getting the same error. Pasted the exact code above just before the protobuf-maven-plugin. Getting a warning on the first <execution> tag: "Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-dependency-plugin:2.10:copy (execution: test-copy-protoc, phase: generate-sources)" I can reproduce the error reliably by simply editing the .proto file. |
Good grief, Maven support in Eclipse is such a royal PITA. Let's try to work around the last error by pasting the following into your POM: <pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<goals>
<goal>copy</goal>
</goals>
<versionRange>[0.0,)</versionRange>
</pluginExecutionFilter>
<action>
<execute>
<runOnIncremental>true</runOnIncremental>
</execute >
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement> If it screws up Maven integration for the project, comment it out. What we are trying to do here is to force Eclipse to invoke the dependency plugin on each incremental build. If the problem is with passing the environment properties to the plugin, then it will show up. All in all, I am still convinced it is an Eclipse problem. |
I'm certain it's an Eclipse problem. Pasted the pluginManagement section into the pom, got same error and same behavior, made no difference. Here's the full pom now: https://gist.github.com/ccleve/57f75e41f27ba569c93b515010ee0f59 |
Can you post a screenshot of Eclipse please, with error location and error text/tooltip clearly visible? |
Pic attached. Line 108, which is covered, is "<execution>". The complete text of the error is here: https://gist.github.com/ccleve/fa8d24dc6e52363da4b90dfc9db5dcbe Fixed pic: |
I am really afraid that I won't be able to help here. Feel free to remove any experimental rubbish we had to introduce into the POM. I think the best course of action might be in stripping it down to a small reproducible test project and reporting to the person behind As a last ditch attempt to track down the root cause, can you please check that the version of Maven configured in Eclipse is relatively recent. |
I actually managed to resolve this issue with the following pom configuration:
Eclipse then runs the os-maven-detect plugin on build and resolves the os.detected.classifier property, so the protoc plugin can resolve artifact and run the os-specific protoc compiler. There is no need to copy the os-maven-detect plugin into eclipse_home/plugins. The corresponding pom sections:
<plugin>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.5.0.Final</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>detect</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<versionRange>[1.5.0.Final,)</versionRange>
<goals>
<goal>detect</goal>
</goals>
</pluginExecutionFilter>
<action>
<execute></execute>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin> |
@szab100 Let me submit a PR with part 2 of your comment above (m2e lifecycle metadata) to os-maven-plugin. In that case it will be bundled with the plugin and it won't be necessary to pollute the POM with that information. |
@sergei-ivanov That sounds great! Please update this thread when it's done, so I can test if it works that way! Would be great to avoid having this m2e lifecycle config in the main pom. |
@szab100 PR raised (see above). Feel free to test it and upvote it. |
os-maven-plugin version 1.6.1 has been released with embedded m2e metadata. Please upgrade your projects and follow the updated instructions: |
I'm using the plugin in Eclipse. Each time I open the Eclipse project that uses it I get pom and compile errors. If I do a full Maven build the errors go away.
The first error is on the pom:
Multiple annotations found at this line:
- Missing: ---------- 1) com.google.protobuf:protoc:exe:${os.detected.classifier}:3.0.0 Try downloading the file manually from the project website. Then, install it using the command: mvn install:install-file -
DgroupId=com.google.protobuf -DartifactId=protoc -Dversion=3.0.0 -Dclassifier=${os.detected.classifier} -Dpackaging=exe -Dfile=/path/to/file Alternatively, if you host your own repository...
protoc is, in fact, properly installed, and the error goes away when I do a build.
The second error is that either Eclipse or this plugin intermittently blows away the generated files in /target/generated-sources/protobuf. It usually happens on Eclipse startup but also happens sometimes while I'm working.
I can't tell if this is a plugin bug or an Eclipse/Maven bug.
The text was updated successfully, but these errors were encountered: