-
-
Notifications
You must be signed in to change notification settings - Fork 300
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
bnd-maven-plugin/m2e: BuildContext.isIncremental() is not reliable #1405
Comments
So M2E is broken and we have to work around it? |
The problem is IMHO in the JavaBuilder of Eclipse. It has some heuristics as to when to upgrade an AUTO_BUILD to a FULL_BUILD, but the Builder framework has no means of notifying the other builders of that fact (at least I did not see any). So there's really no way for another builder to know that someone before deleted the whole output directory. |
IncrementalProjectBuilders are notified of the build type. See https://github.com/bndtools/bndtools/blob/master/bndtools.builder/src/org/bndtools/builder/BndtoolsBuilder.java#L141. I assume M2E is also an IncrementalProjectBuilder and thus can know if the build is incremental or full and then return the proper information from BuildContext.isIncremental. |
the build type is AUTO_BUILD, but in some cases the JavaBuilder still assumes a full build, see https://github.com/maxeler/eclipse/blob/master/eclipse.jdt.core/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/builder/JavaBuilder.java#L177-209 |
So unless it is an INCREMENTAL build, BuildContext.isIncremental should return false. AUTO or FULL should be assumed non-incremental. This is what the BndtoolsBuilder does. |
That's not what the Apidocs say, however. Also, as you can see the JavaBuilder would behave the same on INCREMENTAL.... I thought you'd be interested where there are expected problems with bnd-maven-plugin. I can't do more than to report it. IMHO if there is no MANIFEST.MF at the destination location, there is a problem in any case, so it might be a good check anyways. |
Well the manifest is just one file the plugin writes. DS xml files could also be missing if the java builder deletes files in target/classes. If we cannot trust BuildContext.isIncremental, then there is no point in even calling it. Is the java builder deleting the complete contents of target/classes? Or just the manifest? If, the complete contents, then the missing manifest can be a proxy for the deletion event. |
it's deleting all the content in target/classes |
Follow-up to #1346
Unfortunately, the BuildContext.isIncremental is not reliable, as an Eclipse build can get promoted to a Full Build. In this case the JDT build cleans the output directory, but bnd-maven-plugin still sees it as an incremental build. So if there are no relevant changes, this will result in a loss of the MANIFEST.MF, as bnd-maven-plugin will not generate one.
So if there is no existing MANIFEST.MF in the output directory, bnd-maven-plugin should assume a full build is going on.
The text was updated successfully, but these errors were encountered: