java.lang.NullPointerException
at com.devonfw.cobigen.cli.utils.CobiGenUtils.initializeCobiGen(CobiGenUtils.java:89)
at com.devonfw.cobigen.cli.commands.GenerateCommand.call(GenerateCommand.java:123)
at com.devonfw.cobigen.cli.commands.GenerateCommand.call(GenerateCommand.java:1)
at picocli.CommandLine.executeUserObject(CommandLine.java:1680)
at picocli.CommandLine.access$900(CommandLine.java:144)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2038)
at picocli.CommandLine$RunLast.handle(CommandLine.java:2005)
at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:1872)
at picocli.CommandLine.execute(CommandLine.java:1801)
at com.devonfw.cobigen.cli.CobiGenCLI.main(CobiGenCLI.java:43)
So to summarize what CobiGen currently demands:
templates artifact name has to contain templates-devon4j for CobiGen-CLI
templates artifact name has to match templates-([^-]+)-(\d+\.?)+.jar$. Side note: I renamed my templates artifactId to templates-devon4j but then noticed that templates-devon4j-2.5.0-snapshot.jar does not match this regex.
in Eclipse however the project has to be named CobiGen_Templates
The templates have to be in the package src.main.templates
This is all historically grown and inconsistent, violating Java/maven conventions, etc.
IMHO CobiGen urgently requires a design for conventions and detection of templates.
My suggestion would be:
Define a new reasonable package namespace for templates. For simplicity I suggest cobigen - you could even keep src.main.templates but IMHO this is kind of sick.
Remove any requirements for Maven GAV coordinates for templates as JAR files/dependencies
So in the end a templates project/module would have its templates in src/main/resources/cobigen
CobiGen would find Templates like this: Thread.currentThread().getContextClassLoader().getResources("cobigen/triggers.xml")
The triggers.xml (feel free to choose any better name but templates.xml is already taken) should be a modular variant of the current context.xml.
For all matches of step 4. the templates are loaded and in triggers.xml could be defined which plugins of cobigen are required that could be installed dynamically if not available.
If no match is found, a legacy machanism could apply for backward compatibility.
Also CobiGen CLI should allow to ease configuration for templates (instead of hacking a pom.xml just put a config in a defined place that can override the defaults).
Steps to reproduce (bug) / Use Case of feature request (enhancement)
Create custom templates and try generation with cobigen-cli by hacking cobigen-cli/pom.xml.
Expected behavior
As a CobiGen user, I want to use my custom templates so that I can generate code specific for the needs of my projects.
Actual behavior
CobiGen has no clearly designed and documented concept for templates and the template detection is full of hacks, inconsistencies and bugs:
I get NPEs like:
So to summarize what CobiGen currently demands:
templates-devon4j
for CobiGen-CLItemplates-([^-]+)-(\d+\.?)+.jar$
. Side note: I renamed my templates artifactId totemplates-devon4j
but then noticed thattemplates-devon4j-2.5.0-snapshot.jar
does not match this regex.CobiGen_Templates
src.main.templates
This is all historically grown and inconsistent, violating Java/maven conventions, etc.
IMHO CobiGen urgently requires a design for conventions and detection of templates. My suggestion would be:
cobigen
- you could even keepsrc.main.templates
but IMHO this is kind of sick.src/main/resources/cobigen
Thread.currentThread().getContextClassLoader().getResources("cobigen/triggers.xml")
triggers.xml
(feel free to choose any better name buttemplates.xml
is already taken) should be a modular variant of the currentcontext.xml
.triggers.xml
could be defined which plugins of cobigen are required that could be installed dynamically if not available.Also CobiGen CLI should allow to ease configuration for templates (instead of hacking a
pom.xml
just put a config in a defined place that can override the defaults).Steps to reproduce (bug) / Use Case of feature request (enhancement)
cobigen-cli/pom.xml
.Related/Dependent Issues
1109
Comments/Hints:
Affected version: