How to specify the classpath to the acceleoCompiler ant task to compile mtl files

二次信任 提交于 2019-12-12 03:55:10

问题


I'm trying to compile Acceleo mtl files using an Ant task:

<target name="compileEmtsFiles">
    <echo>...... Running Acceleo mtl=emtl file compilation</echo>
    <acceleoCompiler 
        sourceFolder="src/main/java" 
        outputFolder="build/classes/main" 
        binaryResource="false" 
        dependencies="" 
        packagesToRegister="com.company.MyAcceleoPackage">
    </acceleoCompiler>
    <echo>...... Finished Acceleo mtl=emtl file compilation</echo>
</target>

But the acceleoCompiler seems to have a problem to find the "com.company.MyAcceleoPackage". It can be found in src/main/java, but I dont know how specify a kind of classpath to acceleoCompiler:

 [echo] ...... Running Acceleo mtl=emtl file compilation
 [acceleoCompiler] com.company.MyAcceleoPackage

 BUILD FAILED
 C:\path\build.acceleo.xml:24: com.company.MyAcceleoPackage

Any ideas how I can proceed?

Regards, Michael


回答1:


I found the solution. I needed to add the bin folder to the classpath of the taskdef:

<path id="acceleoClasspath">
    <!-- for org.eclipse.acceleo.parser_?.jar etc-->
    <fileset dir="libs">
        <include name="**/*.jar" />
    </fileset>
    <pathelement path="bin"/>
</path>

<taskdef id="acceleoCompiler" name="acceleoCompiler" 
    classname="org.eclipse.acceleo.parser.compiler.AcceleoCompiler" 
    classpathref="acceleoClasspath" />


来源:https://stackoverflow.com/questions/18195199/how-to-specify-the-classpath-to-the-acceleocompiler-ant-task-to-compile-mtl-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!