Current FeatureCatalog explicitly mentions all Helidon features and adds them.
This requires us to keep track of features separately from the feature sources, which is hard to refactor (and keep in sync).
To remedy this situation, the following approach is now to be used:
- Each feature
module-info.javais to be annotated with@Featureannotation - For preview features (production ready, but being worked on), use
@Preview - For incubating features (not production ready, for preview only), use
@Incubating - For information related to Native image, use
@Aot
An annotation processor is available to process this annotation and generate a runtime property file with module information.
The module info must require the API, as it is used within the file. As the annotations are source only, we can use
requires static:
requires static io.helidon.common.features.api;Module info example:
import io.helidon.common.features.api.Aot;
import io.helidon.common.features.api.Feature;
import io.helidon.common.features.api.HelidonFlavor;
import io.helidon.common.features.api.Preview;
/**
* GraphQL server integration with Helidon WebServer.
*/
@Preview
@Feature(value = "GraphQL",
in = HelidonFlavor.SE,
invalidIn = {HelidonFlavor.MP})
@Aot(description = "Incubating support, tested on limited use cases")
module io.helidon.webserver.graphql {
requires static io.helidon.common.features.api;
// other module dependencies and configuration
}<dependency>
<groupId>io.helidon.common.features</groupId>
<artifactId>helidon-common-features-api</artifactId>
<scope>provided</scope>
<optional>true</optional>
</dependency>This example provides full plugins tag, if exists, update only relevant sections.
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>io.helidon.common.features</groupId>
<artifactId>helidon-common-features-processor</artifactId>
<version>${helidon.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>