-
Notifications
You must be signed in to change notification settings - Fork 116
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
java.lang.NoSuchMethodError: 'org.eclipse.core.resources.IProject org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest.getProject()' #918
Comments
2.x is a breaking change and consumers need to adapt. Actually it is invalid to import API with open version range and should always exclude the next major version as per https://enroute.osgi.org/FAQ/210-semantic_versioning.html |
Changing API without deprecating it before is very consumer/developer unfriendly. I would assume that due to this change 99% of the custom project configurators are broken with 2.x |
As said, any connector needs to adapt to the new API whether or not it was deprecated. So 100% of m2e connectors actually need to adapt to the new 2.x API. And as said, the correct version range for any consumer prior to 2.x was |
OSGi mandates exported package versions, but m2e core exports packages without an explicit version (leading to the default 0.0.0 being assumed, https://docs.osgi.org/specification/osgi.core/7.0.0/framework.module.html#framework.module.exportpackage). That leads to open range import-package statements in consumers. |
Contributions are welcome :-) |
The readme says for 2.x
I was assuming that legacy was marked as deprecated before, otherwise how should consumers know which parts of the API m2e core developers consider legacy? Even in semantic versioning it is good practice to first deprecate in a minor version before you remove, otherwise you don't give consumers time to adapt. |
Which OSGi instruction are you referring to? https://docs.osgi.org/specification/osgi.core/7.0.0/framework.module.html#framework.module.requirebundle is IMHO worst practice and the version range is just plain wrong for |
As said 2.x requires adjustments, to existing APIs, to replaced API and maybe anything else. From 2.0 on we again try to maintain backward compatibility as much as possible, but we won't add anything back if there is a replacement. Part of 2.x was the movement to Java 17 and some of its new language constructs (records) that are most likely binary incompatible with any pre 1.x API. |
Good point, this indeed is true to records (https://docs.oracle.com/javase/specs/jls/se17/html/jls-13.html#jls-13.4.27 wich are in no way backwards compatible (even with simple getter methods of classes), so writing a plugin which is compatible with 1.x as well as 2.x is just not possible as it requires recompilation. In the future to ease a transitioning phase you should do a release in between which already has the new API but keeps the old one (as deprecated) otherwise with 3.x again everything will stop working.... |
If anyone step up to support this use-case probably yes ... in general I don't see we can/will support spawning multiple major versions will become any goal of current m2e commiters ... |
There, backwards compatible. Was that so hard? public record ProjectConfigurationRequest(IMavenProjectFacade mavenProjectFacade, MavenProject mavenProject) {
@Deprecated
public IMavenProjectFacade getMavenProjectFacade() {
return mavenProjectFacade();
}
@Deprecated
public MavenProject getMavenProject() {
return mavenProject();
}
@Deprecated
public IFile getPom() {
return mavenProjectFacade().getPom();
}
@Deprecated
public IProject getProject() {
return mavenProjectFacade().getProject();
}
@Deprecated
public ResolverConfiguration getResolverConfiguration() {
return mavenProjectFacade().getResolverConfiguration();
}
} |
Feel free to create a PR and contribute it. ;) But please add a note about when those then deprecated getters are planned to be removed. I'm interested when you think we we should better break the API if not with a major version increment? And keep in mind that the main problem is that many connectors or in general consumers are unmaintained, so any kind of change will break them. Even the version bump to 2.0 alone can break unmaintained consumers, if they require m2e version [1.x,2). If one manages to adjust the version range, adjusting those getters is trivial. So while this might fix your case it will not solve all problems. |
We clearly won't accept in a good shape project additional deprecated API. It's just too late to think about backward-compatibility, interested parties should have considered that earlier and voiced before we released 2.0. |
I agree, a major release is not and will never be backward compatible (otherwise it won't require a major release). Also as noted above, it won't be binary backward compatible so a project needs to adjust anyways... |
Due to this commit c3ade99#diff-9673d52c15edc7a4a06b4de0e0ac93f73952e7b69f05cc1d1c1fd2653655a4bb the class
ProjectConfigurationRequest
does no longer expose agetProject()
method.As none of the methods of
ProjectConfigurationRequest
apart fromgetMavenSession(...)
in the previous commit https://github.com/eclipse-m2e/m2e-core/blob/fa8a40ba94473380c5c8a7f95555bcf5fda74e11/org.eclipse.m2e.core/src/org/eclipse/m2e/core/project/configurator/ProjectConfigurationRequest.java were deprecated I consider this a mistake.Otherwise all downstream consumers, e.g. https://github.com/apache/sling-ide-tooling/blob/93bcb69fe7cfad6b68d5caf838a14d3bdf887b92/eclipse/eclipse-m2e-ui/src/org/apache/sling/ide/eclipse/m2e/internal/AbstractBundleProjectConfigurator.java#L48 would need to be changed to be compatible with m2e 2.x.
Configuring a Maven project in m2e 2.x leads to the following exception with that plugin:
The same is true for the no-longer existing methods
getPom()
andgetResolverConfiguration()
.The text was updated successfully, but these errors were encountered: