You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Daniel Klco <dk...@apache.org> on 2020/07/23 02:45:31 UTC

Variable Interpolation in Feature Model

Hi,

I've been looking into the feature model for the CMS App and investigating
Robert's Feature Model implementation[1] of the Sling Starter.

One thing I can't get to work is variable interpolation inside the models.
I was expecting that I could do the same thing currently in the
Provisioning model for version variables, such as oak.version or
slf4j.version, but when I attempted to set these variables the feature
model, maven fails when resolving dependencies.

I tried setting the replacePropertyVariables property in the execution as
documented[2] but no change.

Is this not possible or is there something I missed?

[1]
https://github.com/apache/sling-org-apache-sling-starter/tree/feature/SLING-9595
[2] https://github.com/apache/sling-slingfeature-maven-plugin

Re: Variable Interpolation in Feature Model

Posted by Carsten Ziegeler <cz...@apache.org>.
Hi Dan,

> 
> Makes sense. Based on this response, I'm thinking that most likely if you
> were to create a Sling-based application you would not use the Sling
> Starter as a prototype for a couple reasons. First, you wouldn't want to be
> tied to Sling Starter's releases and secondly Starter has a relatively
> opinionated configuration and requires a fair number of removals for
> extension.

Right, it might make sense to use the starter feature model to get 
something up and running quickly. But then you have to live with the 
decisions made their. So agreed, its better to not use it as a base.
> 
> Based on that, it feels like once we transition to feature model, it would
> make a lot of sense to create a number of feature projects for common Sling
> sub-module groups, such as repoinit, composum, oak, etc so that
> implementers of Sling can pull those features rather than defining
> everything from scratch.
> 

Yes, right, I think we said that we transition to these smaller feature 
models - and the starter will aggregate and enhance those.

Regards
Carsten
--
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org

Re: Variable Interpolation in Feature Model

Posted by Daniel Klco <da...@gmail.com>.
Thanks Carsten!

On Thu, Jul 23, 2020 at 1:10 AM Carsten Ziegeler <cz...@apache.org>
wrote:

> Hi,
>
> for your first question from the first mail, there is a test for that as
> part of the plugin. Have a look at
>
> https://github.com/apache/sling-slingfeature-maven-plugin/blob/master/src/it/attach-metadata-from-pom/pom.xml#L54
> how this works.


Thanks, I re-read the example and think I was getting confused between the
variables and the placeholders. It appears to do "variables" in Feature
Model for items which are resolved from Maven, you actually want to use
placeholders and provide the value as a property in the pom.xml. When I
tried using the variables to contain the dependency version, it still fails
to resolve the dependency, but seems to work fine when I put the dependency
variable as a POM property:
https://github.com/apache/sling-org-apache-sling-starter/compare/feature/SLING-9595...feature/SLING-9595-with-variables


>


> What do you mean with "slingfeature artifacts" - the feature model
> itself or a feature archive? Both can be created with the slingfeature
> maven plugin. The model files can be the source of that project, or they
> can be aggregated, or even generated with any other plugin. And then
> they can be attached as artifacts of the project.
> Similar, you can configure the attach-featurearchives mojo to produce
> and attach feature archives based on any feature model.
>

Ah, I got it, the classifier for the artifacts are created as
"slingosgifeature" and my prototype was looking for "slingfeature"


>
> If you want to remove things (bundles, content packages, configurations)
> from a feature then the only way to do this is creating a prototype.
> Features should form a reusable unit, so there should only be rare cases
> where you want or need to remove something from that unit. Of course
> that requires that the units are cut in a good way and are not just a
> collection of random things.
>

Makes sense. Based on this response, I'm thinking that most likely if you
were to create a Sling-based application you would not use the Sling
Starter as a prototype for a couple reasons. First, you wouldn't want to be
tied to Sling Starter's releases and secondly Starter has a relatively
opinionated configuration and requires a fair number of removals for
extension.

Based on that, it feels like once we transition to feature model, it would
make a lot of sense to create a number of feature projects for common Sling
sub-module groups, such as repoinit, composum, oak, etc so that
implementers of Sling can pull those features rather than defining
everything from scratch.


>
> Regards
> Carsten
>
> Am 23.07.2020 um 05:26 schrieb Daniel Klco:
> > Sorry, I found two more questions related to the feature model:
> >
> > 1. How does one produce slingfeature artifacts? I'm not clear how this
> > would work and the Starter reference doesn't do this
> > 2. How would one remove artifacts from an aggregate feature? For
> example, I
> > want to
> > remove com.composum.sling.core:composum-sling-user-management:1.12.0
> > from
> org.apache.sling:org.apache.sling.starter:slingfeature:sling:12-SNAPSHOT
> > (which I sideloaded into my local maven), but when I try to do this, it
> > complains:
> > org.apache.maven.InternalErrorException: Internal error:
> > java.lang.IllegalStateException: Bundle
> > com.composum.sling.core:composum-sling-user-management:1.12.0 can't be
> > removed from feature
> > org.apache.sling:org.apache.sling.starter:slingfeature:sling:12-SNAPSHOT
> as
> > it is not part of that feature.
> > Is this not supported? Or will I need to prototype every aggregated
> module
> > of sling starter?
> >
> > On Wed, Jul 22, 2020 at 10:45 PM Daniel Klco <dk...@apache.org> wrote:
> >
> >> Hi,
> >>
> >> I've been looking into the feature model for the CMS App and
> investigating
> >> Robert's Feature Model implementation[1] of the Sling Starter.
> >>
> >> One thing I can't get to work is variable interpolation inside the
> models.
> >> I was expecting that I could do the same thing currently in the
> >> Provisioning model for version variables, such as oak.version or
> >> slf4j.version, but when I attempted to set these variables the feature
> >> model, maven fails when resolving dependencies.
> >>
> >> I tried setting the replacePropertyVariables property in the execution
> as
> >> documented[2] but no change.
> >>
> >> Is this not possible or is there something I missed?
> >>
> >> [1]
> >>
> https://github.com/apache/sling-org-apache-sling-starter/tree/feature/SLING-9595
> >> [2] https://github.com/apache/sling-slingfeature-maven-plugin
> >>
> >
>
> --
> --
> Carsten Ziegeler
> Adobe Research Switzerland
> cziegeler@apache.org
>

Re: Variable Interpolation in Feature Model

Posted by Carsten Ziegeler <cz...@apache.org>.
Hi,

for your first question from the first mail, there is a test for that as 
part of the plugin. Have a look at 
https://github.com/apache/sling-slingfeature-maven-plugin/blob/master/src/it/attach-metadata-from-pom/pom.xml#L54 
how this works.

What do you mean with "slingfeature artifacts" - the feature model 
itself or a feature archive? Both can be created with the slingfeature 
maven plugin. The model files can be the source of that project, or they 
can be aggregated, or even generated with any other plugin. And then 
they can be attached as artifacts of the project.
Similar, you can configure the attach-featurearchives mojo to produce 
and attach feature archives based on any feature model.

If you want to remove things (bundles, content packages, configurations) 
from a feature then the only way to do this is creating a prototype. 
Features should form a reusable unit, so there should only be rare cases 
where you want or need to remove something from that unit. Of course 
that requires that the units are cut in a good way and are not just a 
collection of random things.

Regards
Carsten

Am 23.07.2020 um 05:26 schrieb Daniel Klco:
> Sorry, I found two more questions related to the feature model:
> 
> 1. How does one produce slingfeature artifacts? I'm not clear how this
> would work and the Starter reference doesn't do this
> 2. How would one remove artifacts from an aggregate feature? For example, I
> want to
> remove com.composum.sling.core:composum-sling-user-management:1.12.0
> from org.apache.sling:org.apache.sling.starter:slingfeature:sling:12-SNAPSHOT
> (which I sideloaded into my local maven), but when I try to do this, it
> complains:
> org.apache.maven.InternalErrorException: Internal error:
> java.lang.IllegalStateException: Bundle
> com.composum.sling.core:composum-sling-user-management:1.12.0 can't be
> removed from feature
> org.apache.sling:org.apache.sling.starter:slingfeature:sling:12-SNAPSHOT as
> it is not part of that feature.
> Is this not supported? Or will I need to prototype every aggregated module
> of sling starter?
> 
> On Wed, Jul 22, 2020 at 10:45 PM Daniel Klco <dk...@apache.org> wrote:
> 
>> Hi,
>>
>> I've been looking into the feature model for the CMS App and investigating
>> Robert's Feature Model implementation[1] of the Sling Starter.
>>
>> One thing I can't get to work is variable interpolation inside the models.
>> I was expecting that I could do the same thing currently in the
>> Provisioning model for version variables, such as oak.version or
>> slf4j.version, but when I attempted to set these variables the feature
>> model, maven fails when resolving dependencies.
>>
>> I tried setting the replacePropertyVariables property in the execution as
>> documented[2] but no change.
>>
>> Is this not possible or is there something I missed?
>>
>> [1]
>> https://github.com/apache/sling-org-apache-sling-starter/tree/feature/SLING-9595
>> [2] https://github.com/apache/sling-slingfeature-maven-plugin
>>
> 

-- 
--
Carsten Ziegeler
Adobe Research Switzerland
cziegeler@apache.org

Re: Variable Interpolation in Feature Model

Posted by Daniel Klco <dk...@apache.org>.
Sorry, I found two more questions related to the feature model:

1. How does one produce slingfeature artifacts? I'm not clear how this
would work and the Starter reference doesn't do this
2. How would one remove artifacts from an aggregate feature? For example, I
want to
remove com.composum.sling.core:composum-sling-user-management:1.12.0
from org.apache.sling:org.apache.sling.starter:slingfeature:sling:12-SNAPSHOT
(which I sideloaded into my local maven), but when I try to do this, it
complains:
org.apache.maven.InternalErrorException: Internal error:
java.lang.IllegalStateException: Bundle
com.composum.sling.core:composum-sling-user-management:1.12.0 can't be
removed from feature
org.apache.sling:org.apache.sling.starter:slingfeature:sling:12-SNAPSHOT as
it is not part of that feature.
Is this not supported? Or will I need to prototype every aggregated module
of sling starter?

On Wed, Jul 22, 2020 at 10:45 PM Daniel Klco <dk...@apache.org> wrote:

> Hi,
>
> I've been looking into the feature model for the CMS App and investigating
> Robert's Feature Model implementation[1] of the Sling Starter.
>
> One thing I can't get to work is variable interpolation inside the models.
> I was expecting that I could do the same thing currently in the
> Provisioning model for version variables, such as oak.version or
> slf4j.version, but when I attempted to set these variables the feature
> model, maven fails when resolving dependencies.
>
> I tried setting the replacePropertyVariables property in the execution as
> documented[2] but no change.
>
> Is this not possible or is there something I missed?
>
> [1]
> https://github.com/apache/sling-org-apache-sling-starter/tree/feature/SLING-9595
> [2] https://github.com/apache/sling-slingfeature-maven-plugin
>