From 06269ba01470177f892e7ef33a16402e339f0c2c Mon Sep 17 00:00:00 2001 From: Hugi Thordarson Date: Mon, 3 Nov 2025 22:48:33 +0000 Subject: [PATCH 1/3] #1025 Fix bundleless builds in maven projects --- .../Sources/er/extensions/appserver/ERXApplication.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Frameworks/Core/ERExtensions/Sources/er/extensions/appserver/ERXApplication.java b/Frameworks/Core/ERExtensions/Sources/er/extensions/appserver/ERXApplication.java index 156e5d3cd2e..4348ba2c39c 100644 --- a/Frameworks/Core/ERExtensions/Sources/er/extensions/appserver/ERXApplication.java +++ b/Frameworks/Core/ERExtensions/Sources/er/extensions/appserver/ERXApplication.java @@ -524,7 +524,7 @@ else if (jar.endsWith(".jar")) { } // MS: This is totally hacked in to make Wonder startup properly with the new rapid turnaround. It's duplicating (poorly) // code from NSProjectBundle. I'm not sure we actually need this anymore, because NSBundle now fires an "all bundles loaded" event. - else if (jar.endsWith("/bin") && new File(new File(jar).getParentFile(), ".project").exists()) { + else if ((jar.endsWith("/bin") && new File(new File(jar).getParentFile(), ".project").exists()) || (jar.endsWith("/target/classes") && new File(new File(jar).getParentFile().getParentFile(), ".project").exists())) { // AK: I have no idea if this is checked anywhere else, but this keeps is from having to set it in the VM args. debugMsg("Plain bundle: " + jar); for (File classpathFolder = new File(bundle); classpathFolder != null && classpathFolder.exists(); classpathFolder = classpathFolder.getParentFile()) { From b5d98784325c3aa52ec80e65cf135dbb01fe1b92 Mon Sep 17 00:00:00 2001 From: Hugi Thordarson Date: Fri, 7 Nov 2025 06:57:49 +0000 Subject: [PATCH 2/3] Don't exclude the app project bundle from ERXApp.Loader's loading --- .../Sources/er/extensions/appserver/ERXApplication.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Frameworks/Core/ERExtensions/Sources/er/extensions/appserver/ERXApplication.java b/Frameworks/Core/ERExtensions/Sources/er/extensions/appserver/ERXApplication.java index 4348ba2c39c..744a3de90c9 100644 --- a/Frameworks/Core/ERExtensions/Sources/er/extensions/appserver/ERXApplication.java +++ b/Frameworks/Core/ERExtensions/Sources/er/extensions/appserver/ERXApplication.java @@ -540,7 +540,7 @@ else if ((jar.endsWith("/bin") && new File(new File(jar).getParentFile(), ".proj Node natureNode = natureContainerNode.getFirstChild(); String nodeValue = natureNode.getNodeValue(); // AK: we don't actually add apps to the bundle process (Mike, why not!?) - if (nodeValue != null && nodeValue.startsWith("org.objectstyle.wolips.") && !nodeValue.contains("application")) { + if (nodeValue != null && nodeValue.startsWith("org.objectstyle.wolips.") /* && !nodeValue.contains("application") */) { isBundle = true; } } From 49922987c0bd2cc357760947884ca5205e978a2a Mon Sep 17 00:00:00 2001 From: Hugi Thordarson Date: Fri, 7 Nov 2025 09:12:17 +0000 Subject: [PATCH 3/3] Identify project bundle using build.properties --- .../extensions/appserver/ERXApplication.java | 52 +++++++++---------- 1 file changed, 25 insertions(+), 27 deletions(-) diff --git a/Frameworks/Core/ERExtensions/Sources/er/extensions/appserver/ERXApplication.java b/Frameworks/Core/ERExtensions/Sources/er/extensions/appserver/ERXApplication.java index 744a3de90c9..a1c8869741c 100644 --- a/Frameworks/Core/ERExtensions/Sources/er/extensions/appserver/ERXApplication.java +++ b/Frameworks/Core/ERExtensions/Sources/er/extensions/appserver/ERXApplication.java @@ -524,40 +524,38 @@ else if (jar.endsWith(".jar")) { } // MS: This is totally hacked in to make Wonder startup properly with the new rapid turnaround. It's duplicating (poorly) // code from NSProjectBundle. I'm not sure we actually need this anymore, because NSBundle now fires an "all bundles loaded" event. - else if ((jar.endsWith("/bin") && new File(new File(jar).getParentFile(), ".project").exists()) || (jar.endsWith("/target/classes") && new File(new File(jar).getParentFile().getParentFile(), ".project").exists())) { + else if ((jar.endsWith("/bin") && new File(new File(jar).getParentFile(), "build.properties").exists()) || (jar.endsWith("/target/classes") && new File(new File(jar).getParentFile().getParentFile(), "build.properties").exists())) { // AK: I have no idea if this is checked anywhere else, but this keeps is from having to set it in the VM args. debugMsg("Plain bundle: " + jar); for (File classpathFolder = new File(bundle); classpathFolder != null && classpathFolder.exists(); classpathFolder = classpathFolder.getParentFile()) { - File projectFile = new File(classpathFolder, ".project"); - if (projectFile.exists()) { + File buildPropertiesFile = new File(classpathFolder, "build.properties"); + + if (buildPropertiesFile.exists()) { try { boolean isBundle = false; - Document projectDocument = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(projectFile); - projectDocument.normalize(); - NodeList natureNodeList = projectDocument.getElementsByTagName("nature"); - for (int natureNodeNum = 0; !isBundle && natureNodeNum < natureNodeList.getLength(); natureNodeNum ++) { - Element natureContainerNode = (Element)natureNodeList.item(natureNodeNum); - Node natureNode = natureContainerNode.getFirstChild(); - String nodeValue = natureNode.getNodeValue(); - // AK: we don't actually add apps to the bundle process (Mike, why not!?) - if (nodeValue != null && nodeValue.startsWith("org.objectstyle.wolips.") /* && !nodeValue.contains("application") */) { - isBundle = true; + String bundleName = classpathFolder.getName(); + + if (buildPropertiesFile.exists()) { + Properties buildProperties = new Properties(); + buildProperties.load(new FileReader(buildPropertiesFile)); + if (buildProperties.get("project.name") != null) { + // the project folder might be named differently than the actual bundle name + bundleName = (String) buildProperties.get("project.name"); + + // Basing isBundle on "project.type" (commented out code) is probably better, but the maven archetypes don't contain a "project.type" property // Hugi 2025-11-07 + isBundle = bundleName != null; + /* + String projectType = (String) buildProperties.get("project.type"); + + if( "application".equals(projectType) || "framework".equals(projectType) ) { + isBundle = true; + } + */ } } + if (isBundle) { System.setProperty("NSProjectBundleEnabled", "true"); - String bundleName = classpathFolder.getName(); - - File buildPropertiesFile = new File(classpathFolder, "build.properties"); - if (buildPropertiesFile.exists()) { - Properties buildProperties = new Properties(); - buildProperties.load(new FileReader(buildPropertiesFile)); - if (buildProperties.get("project.name") != null) { - // the project folder might be named differently than the actual bundle name - bundleName = (String) buildProperties.get("project.name"); - } - } - allFrameworks.add(bundleName); debugMsg("Added Binary Bundle (Project bundle): " + bundleName); } else { @@ -565,11 +563,11 @@ else if ((jar.endsWith("/bin") && new File(new File(jar).getParentFile(), ".proj } } catch (Throwable t) { - System.err.println("Skipping '" + projectFile + "': " + t); + System.err.println("Skipping '" + buildPropertiesFile + "': " + t); } break; } - debugMsg("Skipping, no project: " + projectFile); + debugMsg("Skipping, no project: " + buildPropertiesFile); } } }