Skip to content

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

@wltjr

Description

@wltjr

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)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions