wildfly / wildfly-glow

Galleon Layers Output from War: Automatic discover of WildFly provisioning information from an application.
Apache License 2.0
7 stars 7 forks source link

Support layer exclusion #78

Open fabrii opened 5 months ago

fabrii commented 5 months ago

It would be nice to support layer exclusion on WildFly Glow CLI.

In certain cases, some layers are added because of classes that are present (but not used) in dependencies.

For example, primefaces library adds the "jpa" layer while infinispan-cdi-embedded-jakarta adds the "micrometer" layer.

More info: https://groups.google.com/g/wildfly/c/nhbrC82ZUlg

./wildfly-glow scan --provision=SERVER --add-ons=metrics examples/custom.war
Wildfly Glow is scanning...
context: bare-metal
enabled profile: none
config stability: community
galleon discovery
- feature-packs
   org.wildfly:wildfly-galleon-pack:32.0.1.Final
- layers
   ee-core-profile-server
   microprofile-health
   jaxrs
   microprofile-rest-client
   jsf
   jpa
   micrometer
   metrics
   microprofile-telemetry
 ./wildfly-glow scan --provision=SERVER --add-ons=metrics --exclude-archives-from-scan=primefaces-*.jar examples/custom.war
Wildfly Glow is scanning...
context: bare-metal
enabled profile: none
config stability: community
galleon discovery
- feature-packs
   org.wildfly:wildfly-galleon-pack:32.0.1.Final
- layers
   ee-core-profile-server
   microprofile-health
   jaxrs
   microprofile-rest-client
   jsf
   datasources --> Notice that JPA is gone but now datasources is detected. I am 100% sure the 'datasource layer' is not used by my application, but I dont know which dependency is adding it
   micrometer
   metrics
   microprofile-telemetry
./wildfly-glow scan --provision=SERVER --add-ons=metrics --exclude-archives-from-scan=primefaces-*.jar,infinispan-*.jar examples/custom.war
Wildfly Glow is scanning...
context: bare-metal
enabled profile: none
config stability: community
galleon discovery
- feature-packs
   org.wildfly:wildfly-galleon-pack:32.0.1.Final
- layers
   ee-core-profile-server
   microprofile-health
   jaxrs
   microprofile-rest-client
   jsf
   datasources
   metrics
   microprofile-telemetry

Now micrometer is out.

jfdenise commented 5 months ago

@fabrii , thank-you. Perhaps something to look at in your datasources case is the WildFly Glow documentation, in particular this piece: https://docs.wildfly.org/wildfly-galleon-feature-packs/#_galleon_layers_and_associated_discovery_rules you can find what we are looking for for datasources.

jfdenise commented 5 months ago

Something that I should have mentioned that will help you understand why a layer is present. We have documentation for the latest WildFly version that covers the rules WildFly Glow relies on to identify layers. In this documentation: https://docs.wildfly.org/wildfly-galleon-feature-packs/ you will find the existing rules (generic description), all the supported galleon feature-packs for a given WildFly version, and for each defined layer, the actual rules that are in use. For example, for datasources we can see: org.wildfly.rule.class https://docs.wildfly.org/wildfly-galleon-feature-packs/#glow.org.wildfly.rule.class =java.sql,javax.sql This means that if a class from these 2 packages is referenced, then datasources layer is added.

On Mon, Jun 17, 2024 at 9:31 PM Fabricio Gregorio @.***> wrote:

It would be nice to support layer exclusion on WildFly Glow CLI.

In certain cases, some layers are added because of classes that are present (but not used) in dependencies.

For example, primefaces library adds the "jpa" layer while infinispan-cdi-embedded-jakarta adds the "micrometer" layer.

More info: https://groups.google.com/g/wildfly/c/nhbrC82ZUlg

./wildfly-glow scan --provision=SERVER --add-ons=metrics examples/custom.war Wildfly Glow is scanning... context: bare-metal enabled profile: none config stability: community galleon discovery

  • feature-packs org.wildfly:wildfly-galleon-pack:32.0.1.Final
  • layers ee-core-profile-server microprofile-health jaxrs microprofile-rest-client jsf jpa micrometer metrics microprofile-telemetry

    ./wildfly-glow scan --provision=SERVER --add-ons=metrics --exclude-archives-from-scan=primefaces-*.jar examples/custom.war Wildfly Glow is scanning... context: bare-metal enabled profile: none config stability: community galleon discovery

  • feature-packs org.wildfly:wildfly-galleon-pack:32.0.1.Final
  • layers ee-core-profile-server microprofile-health jaxrs microprofile-rest-client jsf datasources --> Notice that JPA is gone but now datasources is detected. I am 100% sure the 'datasource layer' is not used by my application, but I dont know which dependency is adding it micrometer metrics microprofile-telemetry

./wildfly-glow scan --provision=SERVER --add-ons=metrics --exclude-archives-from-scan=primefaces-.jar,infinispan-.jar examples/custom.war Wildfly Glow is scanning... context: bare-metal enabled profile: none config stability: community galleon discovery

  • feature-packs org.wildfly:wildfly-galleon-pack:32.0.1.Final
  • layers ee-core-profile-server microprofile-health jaxrs microprofile-rest-client jsf datasources metrics microprofile-telemetry

Now micrometer is out.

— Reply to this email directly, view it on GitHub https://github.com/wildfly/wildfly-glow/issues/78, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7KEC7RYFN377M3O23Q3YDZH42QPAVCNFSM6AAAAABJOTNHD6VHI2DSMVQWIX3LMV43ASLTON2WKOZSGM2TQMBZGYZTCNQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>