You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by "Carsten Ziegeler (JIRA)" <ji...@apache.org> on 2013/09/27 13:43:02 UTC

[jira] [Commented] (FELIX-4246) SCR and Metatype descriptor files get deleted on subsequent (incremental) eclipse build

    [ https://issues.apache.org/jira/browse/FELIX-4246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13779844#comment-13779844 ] 

Carsten Ziegeler commented on FELIX-4246:
-----------------------------------------

Both descriptor files are affected - the plugin deletes all of them if there is no source. This looks like a wrong behaviour in the case of an incremental build.
As a first fix, I'Ve added an incremental flag to the options which is set by the maven plugin and in that case no descriptor files are removed.
In the ant case everything is removed (like before) - and a mvn clean should remove the whole target directory. So this should work
                
> SCR and Metatype descriptor files get deleted on subsequent (incremental) eclipse build
> ---------------------------------------------------------------------------------------
>
>                 Key: FELIX-4246
>                 URL: https://issues.apache.org/jira/browse/FELIX-4246
>             Project: Felix
>          Issue Type: Bug
>          Components: Maven SCR Plugin
>    Affects Versions: maven-scr-plugin 1.14.0
>         Environment: Eclipse, m2eclipse
>            Reporter: Stefan Egli
>            Assignee: Carsten Ziegeler
>             Fix For: maven-scr-plugin 1.14.2, scr generator 1.8.2
>
>
> There's a regression bug introduced in maven-scr-plugin 1.14.0 which *worked fine in 1.13.0*. Consider the following scenario:
>  * a project is setup in eclipse/m2eclipse using the maven-scr-plugin 1.14.0 and contains java classes annotated with @Service and/or @Components
>  * the project is cleaned ('clean project') and built ('build project')
>  -> the descriptor .xml files are created as expected
>  * when the project is built again (incrementally, eg manually triggering another 'build project'), the descriptor .xml files are deleted
> Some debugging narrows the problem down to the MavenProjectScanner.getSourcesForScanKind, where the buildContext.newScanner is invoked. The scanner returned there is of type EclipseBuildContext (set by m2eclipse) when doing a build right after a clean - and in this case the scanner finds java files, sets those via project.setSources and MetaTypeIO.generateDescriptors correctly generates the descriptors.
> In the incremental(-eclipse)-build case though, the buildContext.newScanner returns an EclipseIncrementalBuildContext - which results in an empty set of sources being passed to project.setScanner, hence later down the call-stack MetaTypeIO.generateDescriptors gets an empty list of components, thus *thinks it's a good idea to go through the metatype directory and delete 'obsolete' metatype files* - when in fact they are not quite obsolete..
> Maybe it would be better to hook into the 'clean' method for deleting/cleaning up?

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira