Home » Modeling » M2T (model-to-text transformation) » [acceleo 3.2] dependency problem with jar
[acceleo 3.2] dependency problem with jar [message #753561] |
Thu, 27 October 2011 17:12  |
Marc Missing name Messages: 38 Registered: March 2011 |
Member |
|
|
Hi !
I'm using acceleo in a standalone env (I'm using a standalone acceleo compiler for building .emtl & I'm running my application outside of eclipse).
It was working great until very recently, and I don't know why. As I was using a nightly, I cleaned everything and installed acceleo 3.2 and use these jars in my application now.
But it looks like when a module B, located in my.jarB.jar is using module A, located in my.jarA.jar, there is a problem at runtime [previously, I had a problem during standalone compilation, now it's compiling fine, but not running]. I get these kind of error message:
org.eclipse.acceleo.engine.AcceleoEvaluationException: Unresolved compilation error in generation module.
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1671)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1009)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoQueryInvocation(AcceleoEvaluationVisitor.java:836)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1721)
at org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1009)
....
org.eclipse.acceleo.engine.AcceleoEvaluationException: Invalid result for expression if unresolved query invocation : null() then unresolved query invocation : null().replaceAll('^"', '').replaceAll('"$', '').tokenize(',') else Sequence {} endif->union(getUserIncludes(aType.eContainer(SomeRandomModelClassName))) at line 103 in Module common for query getUserIncludes(SomeOtherModelClassType). Last recorded value of self was SomeModelClassNameImpl@6a435f (name: Atom). Problem found while generating the file 'bla.hpp'.
...
In fact, the exact dep is 'B1 -> B2 -> A' with modules B1 & B2 in my.jarB.jar and A in my.jarA.jar.
The query that causes this error is in B2 (B1 only calls it):
[query public getUserIncludes(aPackage : SomeRandomModelClassName) : Sequence(String) =
if aPackage.hasAnnotation('cpp', 'include') then
'inc1.hpp,incl2.hpp'.tokenize(',')
else
Sequence{}
endif
/]
[query public getUserIncludes(aType : SomeOtherModelClassType) : Sequence(String) =
(if aType.hasAnnotation('cpp', 'include') then
'incT.hpp'.replaceAll('^"', '').replaceAll('"$', '').tokenize(',')
else
Sequence{}
endif)->union(aType.eContainer(SomeRandomModelClassName).getUserIncludes())
/]
B1 simply class the getUserIncludes(aType : SomeOtherModelClassType) query located in B2. Query "hasAnnotation" is located in module A. Commenting out this call removes all errors. [the tokenizing of the hardcoded strings are stupid and only here to simplify the test case]
I guess the unresolved query invocation : null() are not a good sign.
[Updated on: Thu, 27 October 2011 17:18] Report message to a moderator
|
|
|
Re: [acceleo 3.2] dependency problem with jar [message #753566 is a reply to message #753561] |
Thu, 27 October 2011 18:00   |
Ed Willink Messages: 7598 Registered: July 2009 |
Senior Member |
|
|
Hi Marc
My observation is that the Acceleo 3.1 builder was very enthusiastic
rebuilding everything at the slightest excuse. This enthusiasm has been
'fixed' in 3.2, but now many necessary rebuilds do not occur and some
that do, are not displayed in problem markers or detected by a cannot
launch diagnostic, so you get to see the run-time consequence.
clean doesn't work reliably either.
The workaround seems to be to do dummy edits in MTL files so that you
see the markers. Saving them sometimes clears or reveals others.
Eventually you find your bugs and can execute.
Regards
Ed Willink
On 27/10/2011 18:12, Marc wrote:
> Hi !
>
> I'm using acceleo in a standalone env (I'm using a standalone acceleo
> compiler for building .emtl & I'm running my application outside of
> eclipse).
>
> It was working great until very recently, and I don't know why. As I
> was using a nightly, I cleaned everything and installed acceleo 3.2
> and use these jars in my application now.
>
> But it looks like when a module B, located in my.jarB.jar is using
> module A, located in my.jarA.jar, there is a problem at runtime
> [previously, I had a problem during standalone compilation, now it's
> compiling fine, but not running]. I get these kind of error message:
>
> org.eclipse.acceleo.engine.AcceleoEvaluationException: Unresolved
> compilation error in generation module.
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1671)
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1009)
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitAcceleoQueryInvocation(AcceleoEvaluationVisitor.java:836)
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.switchExpression(AcceleoEvaluationVisitor.java:1721)
> at
> org.eclipse.acceleo.engine.internal.evaluation.AcceleoEvaluationVisitor.visitExpression(AcceleoEvaluationVisitor.java:1009)
> ...
> org.eclipse.acceleo.engine.AcceleoEvaluationException: Invalid result
> for expression if unresolved query invocation : null() then unresolved
> query invocation : null().replaceAll('^"', '').replaceAll('"$',
> '').tokenize(',') else Sequence {}
> endif->union(getUserIncludes(aType.eContainer(SomeRandomModelClassName)))
> at line 103 in Module common for query
> getUserIncludes(SomeOtherModelClassType). Last recorded value of self
> was SomeModelClassNameImpl@6a435f (name: Atom). Problem found while
> generating the file 'bla.hpp'.
> ..
>
>
> In fact, the exact dep is 'B1 -> B2 -> A' with modules B1 & B2 in
> my.jarB.jar and A in my.jarA.jar.
>
> The query that causes this error is in B2 (B1 only calls it):
>
>
>
> [query public getUserIncludes(aPackage : SomeRandomModelClassName) :
> Sequence(String) = if aPackage.hasAnnotation('cpp', 'include') then
> 'inc1.hpp,incl2.hpp'.tokenize(',')
> else
> Sequence{}
> endif
> /]
> [query public getUserIncludes(aType : SomeOtherModelClassType) :
> Sequence(String) = (if aType.hasAnnotation('cpp', 'include') then
> 'incT.hpp'.replaceAll('^"', '').replaceAll('"$', '').tokenize(',')
> else
> Sequence{}
>
> endif)->union(aType.eContainer(SomeRandomModelClassName).getUserIncludes())
> /]
>
> B1 simply class the getUserIncludes(aType : SomeOtherModelClassType)
> query. Commenting out this call removes all errors.
>
> I guess the unresolved query invocation : null() are not a good sign.
|
|
| |
Re: [acceleo 3.2] dependency problem with jar [message #753634 is a reply to message #753628] |
Fri, 28 October 2011 07:12   |
Ed Willink Messages: 7598 Registered: July 2009 |
Senior Member |
|
|
On 28/10/2011 07:53, Marc wrote:
> Quote:
>> My observation is that the Acceleo 3.1 builder was very enthusiastic
>> rebuilding everything at the slightest excuse. This enthusiasm has
>> been 'fixed' in 3.2, but now many necessary rebuilds do not occur and
>> some that do, are not displayed in problem markers or detected by a
>> cannot launch diagnostic, so you get to see the run-time consequence.
>>
>> clean doesn't work reliably either.
>>
>> The workaround seems to be to do dummy edits in MTL files so that you
>> see the markers. Saving them sometimes clears or reveals others.
>> Eventually you find your bugs and can execute.
>
>
> I've seen this behavior quite often inside Eclipse. But here I'm using
> a standalone compiler, and of course I've tried to clean everything
> before launching the build. All templates get compiled, but at
> runtime, intermodule-jars dependencies seem broken.
>
> I think what you are describing is another issue...
I don't think so.
"unresolved compilation error" means that some reference in the EMTL
file is null, which is a problem that occurs at compile time, but which
is now sometimes not diagnosed till run-time.
It may be that your standalone compiler is failing to report an error
either because you or Acceleo has neglected to a deep search for
Resource.errors, which is important in order to get all proxy resolution
diagnostics. A good place to set a break point is on the
resourceSet.getEObject(proxyURI, false) in EcoreUtil.resolve(EObject
proxy, ResourceSet resourceSet) which is only invoked after
resourceSet.getEObject(proxyURI, true) has failed so it
a) gives you a unique place to look at what the problem URI is
b) a retry that you can single step through if you're still baffled.
Regards
Ed Willink
|
|
| | | |
Re: [acceleo 3.2] dependency problem with jar [message #753664 is a reply to message #753658] |
Fri, 28 October 2011 09:10   |
Marc Missing name Messages: 38 Registered: March 2011 |
Member |
|
|
Stephane Begaudeau wrote on Fri, 28 October 2011 04:40Hi Marc,
How are you building your jars? In order to do this, you should build the first one normally and then register the path of the second in the dependency attribute for the second one.
I guess the problem comes from that. I'm simply using ant like this:
- acceleo standalone for module A
- 'jar' task on the directory containing the .emtl => A.jar
- acceleo standalone for module B with A.jar in the classpath and in the 'dependencies' attribute of the ant task. The 'packageToRegister' is always empty.
- 'jar' task on the directory containing the .emtl => B.jar
Quote:
Are you using binary or XMI based compilation?
XMI !
Quote:
If you open the emtl file that seems to have a problem and locate the place where the call to this other template should be, what is the uri of the called template?
See my other reply above: platform:/plugin/eclipse_project/..../.emtl
[Updated on: Mon, 31 October 2011 08:57] Report message to a moderator
|
|
| |
Goto Forum:
Current Time: Fri Jun 09 09:15:08 GMT 2023
Powered by FUDForum. Page generated in 0.02922 seconds
|