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

Carsten Ziegeler commented on SLING-10174:
------------------------------------------

The JSON format for a feature is unfortunately a little bit too optimized as it 
treats every unknown root property as an extension. That was not the best 
choice we did.
The question here is whether having $schema in the data is a workaround for a 
tooling problem and should better be solved in the tooling / configuration for 
the tooling - or if this is a common problem. 
If it is the former then there is nothing to do here, if it is the latter we 
must treat those properties to avoid them being handled as an extension

> Feature attribute "$schema":  is read add Artifact Extension
> ------------------------------------------------------------
>
>                 Key: SLING-10174
>                 URL: https://issues.apache.org/jira/browse/SLING-10174
>             Project: Sling
>          Issue Type: Bug
>          Components: Feature Model
>            Reporter: Stefan Bischof
>            Priority: Major
>
> I have a feature Json that uses the "$schema" Attribute for an better 
> integration with eclipse json content assist and validation.
> {code:java}
> {
> "$schema": ["local:../../../../Feature-1.0.0.schema.json",
> "bundles": [
>   "org.apache.sling:org.apache.sling.api:2.20.0"
>   ]
> }{code}
> when running the `feature-maven-plugin` i got this exception because it tryed 
> to read this attribute as an Extension, and by default all unnamed extensions 
> are Artifact Type.
> {code:java}
> [ERROR] Internal error: java.lang.RuntimeException: Unable to read feature 
> /var/home/stbischof/dev/git/geckoFeatures/org.gecko.feature.gogo.ssh/src/main/features/feature.json:
>  
> /var/home/stbischof/dev/git/geckoFeatures/org.gecko.feature.gogo.ssh/src/main/features/feature.json
>  : Key artifact is not a valid artifact id : 
> local:../../../../Feature-1.0.0.schema.json -> [Help 1]
> org.apache.maven.InternalErrorException: Internal error: 
> java.lang.RuntimeException: Unable to read feature 
> /var/home/stbischof/dev/git/geckoFeatures/org.gecko.feature.gogo.ssh/src/main/features/feature.json
>       at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:120)
>       at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
>       at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
>       at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
>       at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
>       at 
> java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.base/java.lang.reflect.Method.invoke(Method.java:564)
>       at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
>       at 
> org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
>       at 
> org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
>       at 
> org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
> Caused by: java.lang.RuntimeException: Unable to read feature 
> /var/home/stbischof/dev/git/geckoFeatures/org.gecko.feature.gogo.ssh/src/main/features/feature.json
>       at 
> org.apache.sling.feature.maven.Preprocessor.readProjectFeatures(Preprocessor.java:330)
>       at 
> org.apache.sling.feature.maven.Preprocessor.process(Preprocessor.java:145)
>       at 
> org.apache.sling.feature.maven.Preprocessor.process(Preprocessor.java:110)
>       at 
> org.apache.sling.feature.maven.mojos.DependencyLifecycleParticipant.afterProjectsRead(DependencyLifecycleParticipant.java:79)
>       at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:264)
>       at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
>       at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
>       ... 11 more
> Caused by: java.io.IOException: 
> /var/home/stbischof/dev/git/geckoFeatures/org.gecko.feature.gogo.ssh/src/main/features/feature.json
>  : Key artifact is not a valid artifact id : 
> local:../../../../Feature-1.0.0.schema.json
>       at 
> org.apache.sling.feature.io.json.FeatureJSONReader.checkTypeArtifactId(FeatureJSONReader.java:456)
>       at 
> org.apache.sling.feature.io.json.FeatureJSONReader.readArtifacts(FeatureJSONReader.java:195)
>       at 
> org.apache.sling.feature.io.json.FeatureJSONReader.readExtensions(FeatureJSONReader.java:364)
>       at 
> org.apache.sling.feature.io.json.FeatureJSONReader.readFeature(FeatureJSONReader.java:709)
>       at 
> org.apache.sling.feature.io.json.FeatureJSONReader.read(FeatureJSONReader.java:77)
>       at 
> org.apache.sling.feature.maven.Preprocessor.readProjectFeatures(Preprocessor.java:314)
>       ... 17 more
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to