I have a Acceleo project (a bunch of *.mtl files, and a Java class which can generate output using these templates). The project works fine as long as I run it from inside Eclipse, but when I compile the *.emtl files using Maven I get a NullPointerException inside AcceleoService#doGenerate()
:
Thread [ModalContext] (Suspended (exception NullPointerException))
AcceleoService.doGenerate(Module, String, EObject, List<Object>, File, Monitor) line: 565
Plugin(AbstractAcceleoGenerator).generate(Monitor) line: 194
Plugin(AbstractAcceleoGenerator).doGenerate(Monitor) line: 159
Plugin.doGenerate(Monitor) line: 211
Plugin.main(String[]) line: 168
NewRPCServiceDefinitionWizard.generatePluginXml(IProgressMonitor) line: 450
NewRPCServiceDefinitionWizard.generateCode(IProgressMonitor) line: 269
NewRPCServiceDefinitionWizard.access$2(NewRPCServiceDefinitionWizard, IProgressMonitor) line: 231
NewRPCServiceDefinitionWizard$3$1.runInWorkspace(IProgressMonitor) line: 315
NewRPCServiceDefinitionWizard$3.run(IProgressMonitor) line: 321
ModalContext$ModalContextThread.run() line: 121
The code in question looks like this:
for (Template template : mainTemplates) {
// Calls the template with each potential arguments
final EClassifier argumentType = template.getParameter().get(0).getType();
// !!! argumentType is null here !!!
if (argumentType.eIsProxy()) {
throw new AcceleoEvaluationException(AcceleoEngineMessages.getString(
"AcceleoService.TypeIsProxy", templateName)); //$NON-NLS-1$
}
So getType()
returns null
. Since this works inside Eclipse, but not when building with Maven, I diffed the generated *.emtl
files and found that the *.emtl
file which works has at the top
<input>
<takesTypesFrom href="http://mycompany.com/xyz#/"/>
</input>
while the one which does not work has
<input/>
Since the NPE was triggered by getType()
returning null
, this looked like a possible cause, but this is as far as I've managed to come.
Any ideas as to what may be wrong here?