Skip to content
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

Closed
erwint opened this issue Apr 11, 2016 · 8 comments
Closed

bnd-maven-plugin/m2e: BuildContext.isIncremental() is not reliable #1405

erwint opened this issue Apr 11, 2016 · 8 comments
Assignees
Milestone

Comments

@erwint
Copy link
Contributor

erwint commented Apr 11, 2016

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.

@bjhargrave
Copy link
Member

So M2E is broken and we have to work around it?

@erwint
Copy link
Contributor Author

erwint commented Apr 11, 2016

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.

@bjhargrave
Copy link
Member

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.

@erwint
Copy link
Contributor Author

erwint commented Apr 11, 2016

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

@bjhargrave
Copy link
Member

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.

@erwint
Copy link
Contributor Author

erwint commented Apr 11, 2016

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.

@bjhargrave
Copy link
Member

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.

@erwint
Copy link
Contributor Author

erwint commented Apr 11, 2016

it's deleting all the content in target/classes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants