Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 Go to next message
Marc Missing name is currently offline Marc Missing nameFriend
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 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4154
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 #753628 is a reply to message #753566] Fri, 28 October 2011 06:53 Go to previous messageGo to next message
Marc Missing name is currently offline Marc Missing nameFriend
Messages: 38
Registered: March 2011
Member
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...
Re: [acceleo 3.2] dependency problem with jar [message #753634 is a reply to message #753628] Fri, 28 October 2011 07:12 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4154
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 #753658 is a reply to message #753628] Fri, 28 October 2011 08:40 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 413
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi 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. Are you using binary or XMI based compilation? 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?


Quote:
I think what you are describing is another issue...

I agree with you on this.

Regards,

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau
Google+: stephane.begaudeau
Blog: http://stephanebegaudeau.tumblr.com
Acceleo Documentation: http://docs.obeonetwork.com/acceleo




Re: [acceleo 3.2] dependency problem with jar [message #753660 is a reply to message #753634] Fri, 28 October 2011 08:51 Go to previous messageGo to next message
Marc Missing name is currently offline Marc Missing nameFriend
Messages: 38
Registered: March 2011
Member
Problem is that when I run the whole thing in Eclipse, it works just fine Sad [I guess it comes from the 'href', see below]

I've tried to look into the generated .emtl from my standalone compiler, and I see path like this:

 <definition href="platform:/plugin/name_of_the_project_in_eclipse/bla/bla/bla/acceleo/templates/annotations.emtl#/0/hasAnnotation"/>


If I put the file directly in the same package, the href is a simple relative path to the emtl. I'll continue the digging, but any hint is welcome !
Re: [acceleo 3.2] dependency problem with jar [message #753663 is a reply to message #753660] Fri, 28 October 2011 09:06 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 4154
Registered: July 2009
Senior Member
Hi Marc

If you want to make platform:/... work standalone, see
https://bugs.eclipse.org/bugs/show_bug.cgi?id=360926#c7.

Regards

Ed Willink


On 28/10/2011 09:51, Marc wrote:
> Problem is that when I run the whole thing in Eclipse, it works just
> fine :( [I guess it comes from the 'href', see below]
>
> I've tried to look into the generated .emtl from my standalone
> compiler, and I see path like this:
>
> <definition
> href="platform:/plugin/name_of_the_project_in_eclipse/bla/bla/bla/acceleo/templates/annotations.emtl#/0/hasAnnotation"/>
>
> If I put the file directly in the same package, the href is a simple
> relative path to the emtl. I'll continue the digging, but any hint is
> welcome !
Re: [acceleo 3.2] dependency problem with jar [message #753664 is a reply to message #753658] Fri, 28 October 2011 09:10 Go to previous messageGo to next message
Marc Missing name is currently offline Marc Missing nameFriend
Messages: 38
Registered: March 2011
Member
Stephane Begaudeau wrote on Fri, 28 October 2011 04:40
Hi 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

Re: [acceleo 3.2] dependency problem with jar [message #753667 is a reply to message #753663] Fri, 28 October 2011 09:22 Go to previous message
Marc Missing name is currently offline Marc Missing nameFriend
Messages: 38
Registered: March 2011
Member
Edward Willink wrote on Fri, 28 October 2011 05:06
Hi Marc

If you want to make platform:/... work standalone, see
https://bugs.eclipse.org/bugs/show_bug.cgi?id=360926#c7.

Regards


Thanks for the pointer, but it's getting way too complex for me. I'll simply forbid dependencies between modules and simply copy files around. Not that clean, but easy to understand...
Previous Topic:Generation with Acceleo failed since 3.1.0M7 but worked for 3.1.0M6a
Next Topic:missing org.eclipse.jet
Goto Forum:
  


Current Time: Fri Nov 28 11:33:03 GMT 2014

Powered by FUDForum. Page generated in 0.03846 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software