Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Tycho build with java service
[Acceleo] Tycho build with java service [message #850756] Fri, 20 April 2012 09:45 Go to next message
Ian Carr is currently offline Ian CarrFriend
Messages: 12
Registered: July 2009
Junior Member
I have three Acceleo plugins in my application which build and run fine in eclipse.

I am now trying to automate my build process using Maven and Tycho on my CI server. I have used
Tycho on other projects and am happy with it's configuration and use.

One of the Acceleo plugins uses a template which defines a query based on a java service:

[comment This one returns the qualified class name having applied any required filtering or mutation /]
[query public filterClassName(names: Sequence(OclAny)) : Sequence(OclAny) = 
invoke('org.xmi2code.acceleo.objc.helper.GenerateHelper', 'filterClassName(java.util.List)', Sequence{names}) 
/]


The definition of the java helper is in a separate plugin.

I have incorporated the Acceleo compile elements into the projects pom files and can build all of the plugins using tycho except the one with the java service.

The build fails on the file containing the usage (and definition above) of the query.

The maven failure message (-X maven option) is:
Caused by: java.lang.RuntimeException: objcutils.mtl
28:Cannot find operation (filterClassName()) for the type (Sequence(OclAny))
28:Cannot find operation (filterClassName()) for the type (Sequence(OclAny))


at org.eclipse.acceleo.parser.compiler.AbstractAcceleoCompiler.compile(AbstractAcceleoCompiler.java:281)
at org.eclipse.acceleo.parser.compiler.AbstractAcceleoCompiler.doCompile(AbstractAcceleoCompiler.java:225)
at org.xmi2code.acceleo.objc.AcceleoCompiler.doCompile(AcceleoCompiler.java:55)
at org.xmi2code.acceleo.objc.AcceleoCompiler.main(AcceleoCompiler.java:45)


I have tried adding the dependencies generated into the build.acceleo to the fourth exec-maven-plugin argument in the pom:

<arguments>  
      <argument>${basedir}/src/</argument>
      <argument>${basedir}/target/classes</argument>
      <argument>false</argument>
      <argument>"${basedir}/../org.xmi2code.core.plugin;${basedir}/../org.xmi2code.acceleo.objc.support;"</argument>  
</arguments>


But still get the same failure.

I am assuming this is some form of classpath problem, any ideas would be useful.

Many thanks

Ian
Re: [Acceleo] Tycho build with java service [message #851926 is a reply to message #850756] Sat, 21 April 2012 13:14 Go to previous messageGo to next message
Ian Carr is currently offline Ian CarrFriend
Messages: 12
Registered: July 2009
Junior Member
Contrary to my previous thoughts, this does not appear to be a classpath issue, it would appear the template compiler does not actually check the availabilty of the java method so it does not apparently need to be on the classpath.

Instead it looks like an ordering problem with importing module compilation.

The following two templates re-produce the problem:

I have had to mangle the UML URI to prevent complaints from this forum about posting URL'S so http->httpX


This one called acceleo.test.templates.common.test.mtl (Note: the second native ocl query refering to the first java query is neccessary to trigger the problem)

[comment encoding = UTF-8 /]
[module test('httpX://www.eclipse.org/uml2/3.0.0/UML')]

[comment This one returns the qualified class name having applied any required filtering or mutation /]
[query public test(names: Sequence(String)) : Sequence(String) = 
invoke('acceleo.test.AccTest', 'wrap(java.util.List)', Sequence{names}) 
/]

[query public className(aClass : NamedElement) : Sequence(OclAny) = 
	 Sequence{aClass.name}->test()
/]


And this one called acceleo.test.templates.common.enumerations.mtl (complete, only needs the import to fail):

[comment encoding = UTF-8 /]
[module enumerations('httpX://www.eclipse.org/uml2/3.0.0/UML')/]

[import acceleo::test::templates::common::test /]


If compiled with these names under maven the following error occurs:

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.1.1:java (default) on project acceleo.test.templates: An exception occured while executing
the Java class. null: InvocationTargetException: test.mtl
[ERROR] 10:Cannot find operation (test()) for the type (Sequence(String))
[ERROR] 10:Cannot find operation (test()) for the type (Sequence(String))


If enumerations.mtl is renamed to Xenumerations.mtl then we get a good compile, a maven success.

It seems the compilation is ordered by file name explicitly or implicitly and this affects the outcome of the compile?

I assume the compile triggered by the import statement is somehow missing the invoke based external operation from the generated class? But if the java service template is compiled first then the operation is present?

Should this be raised as a bug?

full error from maven:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 31.325s
[INFO] Finished at: Sat Apr 21 14:02:35 BST 2012
[INFO] Final Memory: 91M/514M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.1.1:java (default) on project acceleo.test.templates: An exception occured while executing
the Java class. null: InvocationTargetException: test.mtl
[ERROR] 10:Cannot find operation (test()) for the type (Sequence(String))
[ERROR] 10:Cannot find operation (test()) for the type (Sequence(String))
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.1.1:java (default) on project acceleo.test.
templates: An exception occured while executing the Java class. null
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: An exception occured while executing the Java class. null
        at org.codehaus.mojo.exec.ExecJavaMojo.execute(ExecJavaMojo.java:338)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 19 more
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:283)
        at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.RuntimeException: test.mtl
10:Cannot find operation (test()) for the type (Sequence(String))
10:Cannot find operation (test()) for the type (Sequence(String))


        at org.eclipse.acceleo.parser.compiler.AbstractAcceleoCompiler.compile(AbstractAcceleoCompiler.java:281)
        at org.eclipse.acceleo.parser.compiler.AbstractAcceleoCompiler.doCompile(AbstractAcceleoCompiler.java:225)
        at acceleo.test.templates.AcceleoCompiler.doCompile(AcceleoCompiler.java:55)
        at acceleo.test.templates.AcceleoCompiler.main(AcceleoCompiler.java:45)
        ... 6 more

Re: [Acceleo] Tycho build with java service [message #853871 is a reply to message #851926] Mon, 23 April 2012 12:15 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi,

I am currently rewriting from scratch the whole Acceleo / maven integration, but even with the previous one the issue that you are describing here is curious. The result of the compilation should not depend on the order of the files name. Could you attach your example to this bugzilla issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=350476

I'll look into it.

Regards,

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau & @acceleo
Google+: stephane.begaudeau & acceleo
Blog: http://stephanebegaudeau.tumblr.com
Acceleo Documentation: http://docs.obeonetwork.com/acceleo
Re: [Acceleo] Tycho build with java service [message #854976 is a reply to message #853871] Tue, 24 April 2012 12:05 Go to previous messageGo to next message
Ian Carr is currently offline Ian CarrFriend
Messages: 12
Registered: July 2009
Junior Member
Will do.

However having built a plugin with only these two files in for testing this. I don't think anymore that this is specific to the maven build. I believe I have seen the same compile failures (The same messages) occasionaly when opening the eclipse workspace, these can be cleared by making an edit on the included file. I assume this triggers the build on this file alone and hence it works?

Again this does not occur if the names are alphabetically ordered inclusion->includer.

I can confirm that in my original project, the renaming trick, objcutils.mtl to aobjutils.mtl, fixes my Tycho build problem. Changing it back breaks it again.

Hope this helps.
Re: [Acceleo] Tycho build with java service [message #854997 is a reply to message #854976] Tue, 24 April 2012 12:32 Go to previous messageGo to next message
Ian Carr is currently offline Ian CarrFriend
Messages: 12
Registered: July 2009
Junior Member
Given that this doesn't look like a maven specific problem any more I created a new Bugzilla: 377505

(Sorry still not allowed by the forum to post the url link!)

Re: [Acceleo] Tycho build with java service [message #857334 is a reply to message #854997] Thu, 26 April 2012 13:12 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
For those interested, direct link to the aforementionned bugzilla

Laurent Goubet
Obeo
Previous Topic:[Acceleo] Latest build
Next Topic:Newbie question: Simple Generator creation question
Goto Forum:
  


Current Time: Fri Apr 26 09:43:23 GMT 2024

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

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

Back to the top