diff --git a/extensions/quarkus/deployment/src/main/java/org/apache/myfaces/core/extensions/quarkus/deployment/FacesUberJarProcessor.java b/extensions/quarkus/deployment/src/main/java/org/apache/myfaces/core/extensions/quarkus/deployment/FacesUberJarProcessor.java index 3fe700c9f..49090ab8d 100644 --- a/extensions/quarkus/deployment/src/main/java/org/apache/myfaces/core/extensions/quarkus/deployment/FacesUberJarProcessor.java +++ b/extensions/quarkus/deployment/src/main/java/org/apache/myfaces/core/extensions/quarkus/deployment/FacesUberJarProcessor.java @@ -32,7 +32,7 @@ import javax.xml.parsers.ParserConfigurationException; import javax.xml.transform.TransformerException; -import io.quarkus.deployment.IsNormal; +import io.quarkus.deployment.IsProduction; import io.quarkus.deployment.pkg.builditem.UberJarMergedResourceBuildItem; import org.atteo.xmlcombiner.XmlCombiner; import org.jboss.logging.Logger; @@ -61,7 +61,7 @@ public class FacesUberJarProcessor * * @param producer The build item producer for creating `UberJarMergedResourceBuildItem` instances. */ - @BuildStep(onlyIf = IsNormal.class) + @BuildStep(onlyIf = IsProduction.class) void uberJarServiceLoaders(BuildProducer producer) { List serviceFiles = List.of( @@ -89,7 +89,7 @@ void uberJarServiceLoaders(BuildProducer produce * @param generatedResourcesProducer the producer to add generated resources * @param packageConfig the package configuration to check for UBER_JAR type */ - @BuildStep(onlyIf = IsNormal.class) + @BuildStep(onlyIf = IsProduction.class) void uberJarXmlFiles(BuildProducer generatedResourcesProducer, PackageConfig packageConfig) { diff --git a/extensions/quarkus/deployment/src/main/java/org/apache/myfaces/core/extensions/quarkus/deployment/MyFacesProcessor.java b/extensions/quarkus/deployment/src/main/java/org/apache/myfaces/core/extensions/quarkus/deployment/MyFacesProcessor.java index b6c9e60e7..eaa61d63b 100644 --- a/extensions/quarkus/deployment/src/main/java/org/apache/myfaces/core/extensions/quarkus/deployment/MyFacesProcessor.java +++ b/extensions/quarkus/deployment/src/main/java/org/apache/myfaces/core/extensions/quarkus/deployment/MyFacesProcessor.java @@ -18,7 +18,6 @@ */ package org.apache.myfaces.core.extensions.quarkus.deployment; -import java.io.IOException; import java.lang.reflect.Modifier; import java.nio.file.Files; import java.util.ArrayList; @@ -235,15 +234,19 @@ void buildFeature(BuildProducer feature) @BuildStep void buildServlet(WebMetadataBuildItem webMetaDataBuildItem, - BuildProducer feature, BuildProducer servlet, - BuildProducer listener) throws IOException + BuildProducer listener) { WebMetaData webMetaData = webMetaDataBuildItem.getWebMetaData(); - boolean extensionlessViews = webMetaData.getContextParams().stream().anyMatch(p -> - FacesServlet.AUTOMATIC_EXTENSIONLESS_MAPPING_PARAM_NAME.equals(p.getParamName()) - && "true".equals(p.getParamValue())); + boolean extensionlessViews = false; + + if (webMetaData.getContextParams() != null) + { + extensionlessViews = webMetaData.getContextParams().stream().anyMatch(p -> + FacesServlet.AUTOMATIC_EXTENSIONLESS_MAPPING_PARAM_NAME.equals(p.getParamName()) + && "true".equals(p.getParamValue())); + } // handle jakarta.faces.AUTOMATIC_EXTENSIONLESS_MAPPING Set extensionlessViewMappings = extensionlessViews @@ -284,7 +287,7 @@ void buildServlet(WebMetadataBuildItem webMetaDataBuildItem, } else if (!extensionlessViewMappings.isEmpty()) { - // in case when there are extensionless views enabled, we have add mappings for it + // in case when there are extensionless views enabled, we have added mappings for it // this is currently only possible by re-register the FacesServlet // https://github.com/quarkusio/quarkus/issues/49705 builder = createServletBuilderFromMetaData(webMetaData, facesServlet); @@ -471,12 +474,12 @@ void buildFlowScopedMapping(MyFacesRecorder recorder, @BuildStep @Record(ExecutionTime.STATIC_INIT) - void collectTopLevelViews(MyFacesRecorder recorder) throws IOException + void collectTopLevelViews(MyFacesRecorder recorder) { findTopLevelViews().forEach(recorder::registerTopLevelView); } - Set findTopLevelViews() throws IOException + Set findTopLevelViews() { Set topLevelViews = new HashSet<>(); visitRuntimeMetaInfResources(visit -> @@ -499,7 +502,7 @@ else if (!Files.isDirectory(visit.getPath())) return; } - String viewId = "/" + visit.getRelativePath().toString() + String viewId = "/" + visit.getRelativePath() .replace("META-INF/resources/", ""); topLevelViews.add(viewId); } @@ -766,7 +769,7 @@ public List collectSubclasses(CombinedIndexBuildItem combinedIndex, Stri public List collectImplementors(CombinedIndexBuildItem combinedIndex, String className) { List classes = combinedIndex.getIndex() - .getAllKnownImplementors(DotName.createSimple(className)) + .getAllKnownImplementations(DotName.createSimple(className)) .stream() .map(ClassInfo::toString) .collect(Collectors.toList()); @@ -996,13 +999,16 @@ private ServletBuildItem.Builder createServletBuilderFromMetaData(WebMetaData we ServletBuildItem.Builder builder = ServletBuildItem.builder(servletMeta.getName(), servletMeta.getServletClass()); - webMetaData.getServletMappings().forEach(mapping -> + if (webMetaData.getServletMappings() != null) { - if (servletMeta.getName().equals(mapping.getServletName())) + webMetaData.getServletMappings().forEach(mapping -> { - mapping.getUrlPatterns().forEach(builder::addMapping); - } - }); + if (servletMeta.getName().equals(mapping.getServletName())) + { + mapping.getUrlPatterns().forEach(builder::addMapping); + } + }); + } if (servletMeta.getInitParam() != null) { servletMeta.getInitParam()