From 7fb496399c9f144f93e4f39287f9365bdf667658 Mon Sep 17 00:00:00 2001 From: bzssm <358963981@qq.com> Date: Fri, 9 Jan 2026 15:33:17 +0800 Subject: [PATCH 1/2] add java jakarta ee framework detection support Signed-off-by: bzssm <358963981@qq.com> --- .../framework/java/jakartaee_detector.go | 50 +++++++++++++++++++ pkg/apis/enricher/java_enricher.go | 1 + resources/projects/jakartaee/pom.xml | 30 +++++++++++ .../main/java/com/example/HelloResource.java | 16 ++++++ test/apis/component_recognizer_test.go | 6 ++- 5 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 pkg/apis/enricher/framework/java/jakartaee_detector.go create mode 100644 resources/projects/jakartaee/pom.xml create mode 100644 resources/projects/jakartaee/src/main/java/com/example/HelloResource.java diff --git a/pkg/apis/enricher/framework/java/jakartaee_detector.go b/pkg/apis/enricher/framework/java/jakartaee_detector.go new file mode 100644 index 00000000..e8b70df6 --- /dev/null +++ b/pkg/apis/enricher/framework/java/jakartaee_detector.go @@ -0,0 +1,50 @@ +/******************************************************************************* + * Copyright (c) 2021 Red Hat, Inc. + * Distributed under license by Red Hat, Inc. All rights reserved. + * This program is made available under the terms of the + * Eclipse Public License v2.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v20.html + * + * Contributors: + * Red Hat, Inc. + ******************************************************************************/ + +package enricher + +import ( + "context" + + "github.com/devfile/alizer/pkg/apis/model" +) + +type JakartaEEDetector struct{} + +func (j JakartaEEDetector) GetSupportedFrameworks() []string { + return []string{"JakartaEE"} +} + +func (j JakartaEEDetector) GetApplicationFileInfos(componentPath string, ctx *context.Context) []model.ApplicationFileInfo { + return []model.ApplicationFileInfo{} +} + +// DoFrameworkDetection uses the groupId to check for the framework name +func (j JakartaEEDetector) DoFrameworkDetection(language *model.Language, config string) { + jakartaGroupIds := []string{ + "jakarta.platform", // Jakarta EE Platform BOM + "jakarta.servlet", // Servlet API + "jakarta.ws.rs", // JAX-RS (RESTful Web Services) + "jakarta.persistence", // JPA (Persistence) + "jakarta.enterprise", // CDI (Contexts and Dependency Injection) + } + + for _, groupId := range jakartaGroupIds { + if hasFwk, _ := hasFramework(config, groupId, ""); hasFwk { + language.Frameworks = append(language.Frameworks, "JakartaEE") + return + } + } +} + +// DoPortsDetection is not implemented for JakartaEE as port configuration varies by runtime +func (j JakartaEEDetector) DoPortsDetection(component *model.Component, ctx *context.Context) { +} diff --git a/pkg/apis/enricher/java_enricher.go b/pkg/apis/enricher/java_enricher.go index fdbef64f..99bf982f 100644 --- a/pkg/apis/enricher/java_enricher.go +++ b/pkg/apis/enricher/java_enricher.go @@ -34,6 +34,7 @@ func getJavaFrameworkDetectors() []FrameworkDetectorWithConfigFile { &framework.VertxDetector{}, &framework.WildFlyDetector{}, &framework.JBossEAPDetector{}, + &framework.JakartaEEDetector{}, } } diff --git a/resources/projects/jakartaee/pom.xml b/resources/projects/jakartaee/pom.xml new file mode 100644 index 00000000..8c7c0799 --- /dev/null +++ b/resources/projects/jakartaee/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + + com.example + jakartaee-app + 1.0-SNAPSHOT + war + + + 11 + 11 + UTF-8 + + + + + jakarta.platform + jakarta.jakartaee-api + 10.0.0 + provided + + + + + jakartaee-app + + diff --git a/resources/projects/jakartaee/src/main/java/com/example/HelloResource.java b/resources/projects/jakartaee/src/main/java/com/example/HelloResource.java new file mode 100644 index 00000000..1fcce9ef --- /dev/null +++ b/resources/projects/jakartaee/src/main/java/com/example/HelloResource.java @@ -0,0 +1,16 @@ +package com.example; + +import jakarta.ws.rs.GET; +import jakarta.ws.rs.Path; +import jakarta.ws.rs.Produces; +import jakarta.ws.rs.core.MediaType; + +@Path("/hello") +public class HelloResource { + + @GET + @Produces(MediaType.TEXT_PLAIN) + public String hello() { + return "Hello, Jakarta EE!"; + } +} diff --git a/test/apis/component_recognizer_test.go b/test/apis/component_recognizer_test.go index 0fc24d75..abd23e45 100644 --- a/test/apis/component_recognizer_test.go +++ b/test/apis/component_recognizer_test.go @@ -124,6 +124,10 @@ func TestComponentDetectionOnWildFly(t *testing.T) { isComponentsInProject(t, "wildfly", 1, "java", "wildfly") } +func TestComponentDetectionOnJakartaEE(t *testing.T) { + isComponentsInProject(t, "jakartaee", 1, "java", "jakartaee-app") +} + // port detection: java func TestPortDetectionJavaJBossEAP(t *testing.T) { testPortDetectionInProject(t, "jboss-eap", []int{8380}) @@ -423,7 +427,7 @@ func TestComponentDetectionWithGitIgnoreRule(t *testing.T) { func TestComponentDetectionMultiProjects(t *testing.T) { components := getComponentsFromTestProject(t, "") - nComps := 71 + nComps := 72 if len(components) != nComps { t.Errorf("Expected %v components but found %v", strconv.Itoa(nComps), strconv.Itoa(len(components))) } From 824fce322d2ceea900382c2ddb0849217e9ccefb Mon Sep 17 00:00:00 2001 From: bzssm <358963981@qq.com> Date: Mon, 12 Jan 2026 11:59:06 +0800 Subject: [PATCH 2/2] docs: add JakartaEE to supported Java frameworks list Signed-off-by: bzssm <358963981@qq.com> --- docs/public/alizer-spec.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/public/alizer-spec.md b/docs/public/alizer-spec.md index a74a8048..9cb3005e 100644 --- a/docs/public/alizer-spec.md +++ b/docs/public/alizer-spec.md @@ -37,6 +37,7 @@ NOTE: Maven, Gradle and Ant are saved as Tools inside the data structure returne By reading the content of its configuration file and mainly its dependencies section, Alizer is also able to detect frameworks. Currently, it recognizes: +- JakartaEE - Micronaut - OpenLiberty - Quarkus