如何指定类路径的acceleoCompiler Ant任务编译MT​​L文件 [英] How to specify the classpath to the acceleoCompiler ant task to compile mtl files

查看:349
本文介绍了如何指定类路径的acceleoCompiler Ant任务编译MT​​L文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图编译使用Ant任务Acceleo MTL文件:

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>

但acceleoCompiler似乎有一个问题,找到com.company.MyAcceleoPackage。它可以在目录src / main / java目录中,但我不知道如何指定一种类路径来acceleoCompiler:

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

推荐答案

我找到了解决办法。我需要的bin文件夹添加到的taskdef的类路径:

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" />

这篇关于如何指定类路径的acceleoCompiler Ant任务编译MT​​L文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆