Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 3, 2025

The ModelloCLI shaded JAR only bundled modello-core dependencies, excluding the generator plugin modules (java, xml, xsd, etc.). Sisu couldn't discover plugins at runtime, making the CLI non-functional.

Changes

  • New modello-cli module: Declares dependencies on modello-core and all 14 plugin modules, creates properly shaded executable JAR with merged Sisu indexes
  • Removed non-functional shade config: Deleted broken CLI JAR generation from modello-core/pom.xml
  • Updated reactor build: Added modello-cli to parent POM modules

Usage

# Old (broken)
java -jar modello-core-2.5.2-SNAPSHOT-cli.jar model.mdo java output/ 1.0.0 false 1.8
# Error: No such plugin: java

# New (working)
java -jar modello-cli-2.5.2-SNAPSHOT.jar model.mdo java output/ 1.0.0 false 1.8
# Generates Java POJOs successfully

The new CLI JAR includes JavaModelloGenerator and all other plugins in its Sisu index (META-INF/sisu/javax.inject.Named).

Original prompt

This section details on the original issue you should resolve

<issue_title>Cannot use ModelloCLI to convert .mdo files into *.java files - Unable to load java plugin</issue_title>
<issue_description>I am doing abnormal things! I have modello built and running fine. I am trying to use the java plugin. I am seeing some really strange stuff. It seems to initialize twice, and only on the first is the plugins populated. Such that when it goes to getPlugin, the hashmap is empty. I added some debug code.

--- a/src/main/java/org/codehaus/modello/plugin/AbstractPluginManager.java
+++ b/src/main/java/org/codehaus/modello/plugin/AbstractPluginManager.java
@@ -42,6 +42,17 @@ public abstract class AbstractPluginManager<T>

     public void initialize()
     {
+        System.out.println("init");
+        printMap();
+    }
+
+    public void printMap()
+    {
+        for (String name: plugins.keySet()){
+            String key = name.toString();
+            String value = plugins.get(name).toString();
+            System.out.println(key + " " + value);
+        }
     }

     public Map<String, T> getPlugins()
@@ -56,6 +67,8 @@ public abstract class AbstractPluginManager<T>

     public T getPlugin( String name )
     {
+        printMap();
+        System.out.println("getPlugin = "+name);
         T plugin = plugins.get( name );

         if ( plugin == null )

Here is the output,and you can see the plugins are available at first. But then it inits again, not sure why. Seems that is where the empty hashmap comes from. Next I will throw an exception so I can see what is calling that each time. Not sure if this is a bug, or usability issues. Maybe order of plexus jars on classpath? I am doing this via command line, ModelloCLI.

You can see the 2 inits, and by the time it calls getPlugin method, its empty.

init
model org.codehaus.modello.plugin.model.ModelMetadataPlugin@52d455b8
java org.codehaus.modello.plugin.java.metadata.JavaMetadataPlugin@6956de9
init
getPlugin = java
Exception in thread "main" org.codehaus.modello.ModelloRuntimeException: No such plugin: java
        at org.codehaus.modello.plugin.AbstractPluginManager.getPlugin(AbstractPluginManager.java:76)
        at org.codehaus.modello.core.DefaultGeneratorPluginManager.getGeneratorPlugin(DefaultGeneratorPluginManager.java:38)
        at org.codehaus.modello.core.DefaultModelloCore.generate(DefaultModelloCore.java:374)
        at org.codehaus.modello.Modello.generate(Modello.java:65)
        at org.codehaus.modello.ModelloCli.main(ModelloCli.java:49)
```</issue_description>

## Comments on the Issue (you are @copilot in this section)

<comments>
</comments>

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits November 3, 2025 19:04
Co-authored-by: slachiewicz <6705942+slachiewicz@users.noreply.github.com>
Co-authored-by: slachiewicz <6705942+slachiewicz@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix ModelloCLI java plugin loading issue Fix ModelloCLI unable to load generator plugins Nov 3, 2025
Copilot AI requested a review from slachiewicz November 3, 2025 19:19
Copilot finished work on behalf of slachiewicz November 3, 2025 19:19
@slachiewicz slachiewicz marked this pull request as ready for review November 3, 2025 19:33
@slachiewicz slachiewicz added the bug label Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot use ModelloCLI to convert .mdo files into *.java files - Unable to load java plugin

2 participants