Skip to content

Commit 93fd682

Browse files
committed
Fix #729 - newest wfly have different folder structure
Signed-off-by: Rob Stryker <rob@oxbeef.net>
1 parent 958b66e commit 93fd682

1 file changed

Lines changed: 25 additions & 4 deletions

File tree

runtimes/bundles/org.jboss.tools.rsp.server.wildfly/src/main/java/org/jboss/tools/rsp/server/wildfly/beans/impl/ServerBeanTypeWildflyPlus.java

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*******************************************************************************
2-
* Copyright (c) 2015 Red Hat, Inc.
2+
* Copyright (c) 2024 Red Hat, Inc.
33
* Distributed under license by Red Hat, Inc. All rights reserved.
44
* This program is made available under the terms of the
55
* Eclipse Public License v2.0 which accompanies this distribution,
@@ -15,6 +15,7 @@
1515
import java.util.Collections;
1616

1717
import org.jboss.tools.rsp.server.wildfly.impl.util.JBossManifestUtility;
18+
import org.jboss.tools.rsp.server.wildfly.impl.util.LayeredModulePathFactory;
1819

1920
public class ServerBeanTypeWildflyPlus extends JBossServerBeanType {
2021
private boolean web;
@@ -75,11 +76,31 @@ private static boolean canHandleVersion(int beanTypeVersion, int foundVersion) {
7576

7677
public static String getFullVersion(File location,
7778
File systemFile, int majorVersion, String myPrefix) {
79+
File[] roots = new File[]{new File(location, MODULES)};
80+
String moduleId = "org.jboss.as.product";
7881
String found = JBossManifestUtility.getManifestPropFromJBossModulesFolder(
79-
new File[]{new File(location, MODULES)},
80-
"org.jboss.as.product", "main/dir/META-INF",
82+
roots,
83+
moduleId, "main/dir/META-INF",
8184
MANIFEST_PROD_RELEASE_VERS);
82-
return fullVersionIfResponsible(myPrefix, majorVersion, found);
85+
if( found != null )
86+
return fullVersionIfResponsible(myPrefix, majorVersion, found);
87+
return getFullVersionWfly32PlusLayout(roots, moduleId, myPrefix, majorVersion);
88+
}
89+
90+
public static String getFullVersionWfly32PlusLayout(File[] roots, String moduleId, String myPrefix, int majorVersion) {
91+
File[] layeredRoots = LayeredModulePathFactory.resolveLayeredModulePath(roots);
92+
for( int i = 0; i < layeredRoots.length; i++ ) {
93+
File[] jars = JBossManifestUtility.getFilesForModule(layeredRoots[i], moduleId, "main", ManifestUtility.jarFilter());
94+
for( int j = 0; j < jars.length; j++ ) {
95+
File f = jars[j];
96+
String found2 = ManifestUtility.getFullServerVersionFromZipLegacy(f, new String[]{
97+
"Implementation-Version", "JBoss-Product-Release-Version", "JBossAS-Release-Version"});
98+
if( found2 != null ) {
99+
return fullVersionIfResponsible(myPrefix, majorVersion, found2);
100+
}
101+
}
102+
}
103+
return null;
83104
}
84105

85106
private static String fullVersionIfResponsible(String myPrefix, int majorVersion, String found) {

0 commit comments

Comments
 (0)