Hi Carsten

There are a few issues with the current way the plugin works:

1. If for whatever reason the features folder does not contain any features 
then a ‘mvn clean’ will fail. That check should be moved to a Mojo that 
requires a feature file and not being done for all Mojos
2. The DependencyLifecycleParticipant has a state which means that changes to 
features after the loading of the project is not reflected in that state 
meaning that when I generate feature files (CQ / PM converter) then it will not 
be considered by the feature Mojos (I did not do a thorough investigation so I 
might be wrong)
3. All the tests and a full Sling / Peregrine CMS conversion (9 CP packages), 
built and launch worked just fine for me.

I do not think the converter runs too late but it runs within the confines of 
the plugin meaning the DependencyLifecycleParticipant is fire ahead of the 
converters invocation. This is the firing sequence:
- Convert Sling PM to FM
- Convert Peregrine CMS CP to FM
- Aggregate FMs
- Attach FMs
- Analyze FMs

BTW there is also the issue that the ‘slingosgifeature’ packaging / our Plugin 
does not copy resource to the target. This is normally not a problem but I need 
to add a static FM (jcr packageinit) to the converted FMs to make Sling launch. 
I think it would be best to support copying resources and look for features in 
the /target folder instead.

Cheers - Andy

> On Jul 22, 2019, at 12:28 AM, Carsten Ziegeler <cziege...@apache.org> wrote:
> 
> Hi,
> 
> moving this code out of the DependencyLifecycleParticipant will break some 
> functionality. A DependencyLifecycleParticipant is run *before* any mojos and 
> allwos to add dependencies to projects. We use this to add the artifacts from 
> the feature files as dependencies to the maven project in order to use mavens 
> dependency mechanism. For example this allows to use mavens mechanism to 
> check for updates of artifacts etc.
> 
> 
> If we speak about the converter, I guess the problem is that the converter 
> runs too late. So maybe we should rather fix that?
> 
> 
> Regards
> 
> Carsten
> 
> 
> Andreas Schaefer wrote
>> Hi
>> I found a solution by moving the code into the Mojos. The entire code is now 
>> here:
>> AbstractFeatureMojo.prepareProject()
>> And all Mojos interested can call them at the beginning of the execute() 
>> method.
>> This way my Mojo can work w/o any features present and w/o having issues 
>> during the different phases and goals.
>> Let me know if that is an acceptable solution.
>> Cheers - Andy Schaefer
>>> On Jul 16, 2019, at 7:50 AM, Andreas Schaefer <schaef...@me.com.INVALID> 
>>> wrote:
>>> 
>>> Hi Simone
>>> 
>>> I ran into a snafu with the Sling Feature Maven Plugin. This plugin is 
>>> doing a blank check during the initialization phase which is causing 
>>> headaches for the CP Converter goal.
>>> 
>>> There are various issues but the most glaring is the fact that when I use 
>>> placeholders in the FM id like "${project.groupId}” then it will fail to 
>>> even clean the project with ‘mvn clean’ or when there is no feature at all.
>>> 
>>> Can we either disable these tests or move them in the respective Mojos 
>>> (phase) ?
>>> 
>>> Cheers - Andy Schaefer
> --
> Carsten Ziegeler
> Adobe Research Switzerland
> cziege...@apache.org

Reply via email to