Frage

I am trying to construct a maven acceleo generator. The generator consists of multiple acceleo projects (artifacts in maven), with inter-dependencies.

I am running into a problem with the dependencies between emtl files. At runtime, I get errors stating that there are compilation errors in the mtl, (there are not). I am guessing it may be the hrefs within the compiled emtl files.

There is an acceleo maven compile plugin that allows for these to be either:

a) absolute paths (ending up to be via the maven repository)

b) 'platform:/plugin/...' paths.

(a) works if the acceleo projects (maven artifacts) are build on the same machine as the one on which we do the generation, but if the location of the maven repository changes, we have a problem. Hence deploying the maven artifacts ends up being pointless.

(b) doesn't work because running from within maven, 'platform:/plugin/' cannot be resolved.

I have tried to override the 'createURIConverter' method in the AbstractAcceleoGenerator, then using a URLClassLoader we can decode the 'platform:/plugin/' hrefs and find the correct emtl file. I can verify that this seems to be working, however I still get the reported

"org.eclipse.acceleo.engine.AcceleoEvaluationException: Unresolved compilation error in generation module"

any suggestions?

War es hilfreich?

Lösung

The exception was caused by hrefs in the EMTL model resolving to null.

The problem with resolving the hrefs was just a lack of resource factories being registered (the exception informing me of this gets lost in EcoreUtil.resolve which catches the exception with "// Failure to resolve is ignored." - most unhelpful).

So it seems that my approach of "override the ‘createURIConverter’ method, and get it to decode the ‘platform:/plugin/..’ using a URLClassLoader" does work.

Building the URLClassLoader using the same method done in the AcceleoParserMojo.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top