Question

I am attempting to create a standalone ant build file for android. We are using acceleo to generate code.

Here are the steps i am taking within the build.xml.

  1. compile the auto generator
  2. Generate the EMTL files
  3. Generate the code from the EMTL files

Right now, i can run step 1 and it works fine. Then i run step 2 and it fails with the following errors (Step 2 Errors). And then i can run step 3 and it works fine. I then check all of my files and generated code and everything looks fine. However, those errors from step 2 are really bothering me and i need to get them resolved.

Any help will be greatly appreciated and if you need more information, please let me know.

Posted below are the steps in the build.xml and the errors for step 2.


the build.xml information
<target name="compileAutogen" description="Compiles Autogen">
    <javac
        srcdir="${AUTOGEN_SRC}"
        destdir="${AUTOGEN_BIN}"
        classpath="${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.engine_3.2.0.v20111027-0537.jar;${ECLIPSE_HOME}/plugins/org.eclipse.emf.common_2.7.0.v20110912-0920.jar;${ECLIPSE_HOME}/plugins/org.eclipse.emf.ecore_2.7.0.v20110912-0920.jar;${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.model_3.2.0.v20111027-0537.jar"
        executable="${JAVA_JDK}/javac"
        fork="true"
        includeantruntime="false"
        failonerror="false"
    />
</target>

<target name="generateEMTL" description="Generates the EMTL files for Autogen">
    <acceleoCompiler sourceFolder="${AUTOGEN_SRC}"
         outputFolder="${AUTOGEN_BIN}"
         dependencies=""
         binaryResource="false"
         packagesToRegister="org.eclipse.emf.ecore.EcorePackage">
    </acceleoCompiler>
</target>

<target name="generateFrameworkCode" description="Generates the generated code for Framework">
    <java 
        classname="framework.generator.main.Main" 
        classpath="${AUTOGEN_BIN};${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.engine_3.2.0.v20111027-0537.jar;${ECLIPSE_HOME}/plugins/org.eclipse.emf.ecore_2.7.0.v20110912-0920.jar;${ECLIPSE_HOME}/plugins/org.eclipse.emf.common_2.7.0.v20110912-0920.jar;${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.common_3.2.0.v20111027-0537.jar;${ECLIPSE_HOME}/plugins/org.eclipse.acceleo.model_3.2.0.v20111027-0537.jar;${ECLIPSE_HOME}/plugins/org.eclipse.emf.ecore.xmi_2.7.0.v20110520-1406.jar;${ECLIPSE_HOME}/plugins/org.eclipse.ocl.ecore_3.1.1.v20110823-1646.jar;${ECLIPSE_HOME}/plugins/org.eclipse.ocl_3.1.0.v20110913-1213.jar;${ECLIPSE_HOME}/plugins/lpg.runtime.java_2.0.17.v201004271640.jar;${ECLIPSE_HOME}/plugins/org.eclipse.core.runtime.compatibility.registry_3.5.0.v20110505/runtime_registry_compatibility.jar;${ECLIPSE_HOME}/plugins/org.eclipse.core.runtime_3.7.0.v20110110.jar;${ECLIPSE_HOME}/plugins/org.eclipse.osgi_3.7.1.R37x_v20110808-1106.jar;${ECLIPSE_HOME}/plugins/org.eclipse.equinox.common_3.6.0.v20110523.jar;${ECLIPSE_HOME}/plugins/org.eclipse.core.jobs_3.5.100.v20110404.jar;${ECLIPSE_HOME}/plugins/org.eclipse.equinox.registry_3.5.101.R37x_v20110810-1611.jar;${ECLIPSE_HOME}/plugins/org.eclipse.equinox.preferences_3.4.1.R37x_v20110725.jar;${ECLIPSE_HOME}/plugins/org.eclipse.core.contenttype_3.4.100.v20110423-0524.jar;${ECLIPSE_HOME}/plugins/org.eclipse.equinox.app_1.3.100.v20110321.jar;${ECLIPSE_HOME}/plugins/com.google.collect_1.0.0.v201105210816.jar" 
        fork="true">
        <arg value="${MODEL}"/>
        <arg value="${TARGET}"/>
    </java>
</target>

<target 
    name="generateFramework" 
    description="Compiles Autogen, prepares the emtl files and runs the generator for Framework"
    depends="compileAutogen, generateEMTL, generateFrameworkCode"
/>

(Step 2 Errors)
generateEMTL:
[acceleoCompiler] generateDataAccessObject.mtl
[acceleoCompiler] 5:The metamodel couldn't be resolved
[acceleoCompiler] 5:The metamodel couldn't be resolved
[acceleoCompiler] 5:The metamodel couldn't be resolved
[acceleoCompiler] 
[acceleoCompiler] generatePerstNode.mtl
[acceleoCompiler] 5:The metamodel couldn't be resolved
[acceleoCompiler] 5:The metamodel couldn't be resolved
[acceleoCompiler] 
[acceleoCompiler] TreeWalk.mtl
[acceleoCompiler] 5:The metamodel couldn't be resolved
[acceleoCompiler] 5:The metamodel couldn't be resolved
[acceleoCompiler] 

BUILD FAILED
C:\Framework\build.xml:170: generateDataAccessObject.mtl
5:The metamodel couldn't be resolved
5:The metamodel couldn't be resolved
5:The metamodel couldn't be resolved

generatePerstNode.mtl
5:The metamodel couldn't be resolved
5:The metamodel couldn't be resolved

TreeWalk.mtl
5:The metamodel couldn't be resolved
5:The metamodel couldn't be resolved


    at org.eclipse.acceleo.parser.compiler.AcceleoCompiler.execute(AcceleoCompiler.java:121)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.Target.execute(Target.java:390)
    at org.apache.tools.ant.Target.performTasks(Target.java:411)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
    at org.apache.tools.ant.Main.runBuild(Main.java:809)
    at org.apache.tools.ant.Main.startAnt(Main.java:217)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Was it helpful?

Solution 2

Removing extra stuff out of the [module generateDataAccessObject(...)] actually fixed the problem. If i only include http://www.eclipse.org/emf/2002/Ecore and http://www.eclipse.org/acceleo/mtl/3.0 then it works.

OTHER TIPS

Acceleo indicates that the metamodel could not be resolved. What are the packages used by your generator? If you are just using http://www.eclipse.org/EMF/2002/Ecore, you may be able to compile without registering the metamodel as "Ecore" is a specific use case. Otherwise, you should write the classes of the packages of your metamodel instead of "org.eclipse.emf.ecore.EcorePackage".

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top