从蚂蚁调用rake时,得到“(LoadError)没有这样的文件加载 - ant / tasks / raketasks”

时间:2014-03-12 12:56:53

标签: ruby ant rake jruby rake-task

我想从ant中执行rake任务。我的jruby在构建过程中以zip文件的形式提供,我在运行时将其解压缩。我的build.xml如下所示:

<target name="load-rake-task">
    <typedef name="rake" classname="org.jruby.ant.Rake" classpath="${jruby.dir}/jruby/lib/jruby.jar" />
</target>
<target name="build" depends="load-rake-task">
    <rake task="build" />
</target>

当我运行ant build时,它给出了以下异常:

build:
    [rake] LoadError: no such file to load -- ant/tasks/raketasks
    [rake]   require at org/jruby/RubyKernel.java:1085
    [rake]    (root) at <script>:1
BUILD FAILED
build.xml:23: Could not create type rake due to org.jruby.embed.EvalFailedException: (LoadError) no such file to load -- ant/tasks/raketasks
    at org.jruby.embed.internal.EmbedEvalUnitImpl.run(EmbedEvalUnitImpl.java:133)
    at org.jruby.embed.ScriptingContainer.runUnit(ScriptingContainer.java:1264)
    at org.jruby.embed.ScriptingContainer.runScriptlet(ScriptingContainer.java:1257)
    at org.jruby.ant.RakeTaskBase.acquireRakeReference(RakeTaskBase.java:38)
    at org.jruby.ant.RakeTaskBase.<init>(RakeTaskBase.java:17)
    at org.jruby.ant.Rake.<init>(Rake.java:6)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.apache.tools.ant.AntTypeDefinition.innerCreateAndSet(AntTypeDefinition.java:328)
    at org.apache.tools.ant.AntTypeDefinition.createAndSet(AntTypeDefinition.java:274)
    at org.apache.tools.ant.AntTypeDefinition.icreate(AntTypeDefinition.java:219)
    at org.apache.tools.ant.AntTypeDefinition.create(AntTypeDefinition.java:206)
    at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:285)
    at org.apache.tools.ant.ComponentHelper.createComponent(ComponentHelper.java:263)
    at org.apache.tools.ant.UnknownElement.makeObject(UnknownElement.java:429)
    at org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:163)
    at org.apache.tools.ant.Task.perform(Task.java:347)
    at org.apache.tools.ant.Target.execute(Target.java:435)
    at org.apache.tools.ant.Target.performTasks(Target.java:456)
    at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
    at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
    at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
    at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
    at org.apache.tools.ant.Main.runBuild(Main.java:851)
    at org.apache.tools.ant.Main.startAnt(Main.java:235)
    at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
    at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: org.jruby.exceptions.RaiseException: (LoadError) no such file to load -- ant/tasks/raketasks
    at org.jruby.RubyKernel.require(org/jruby/RubyKernel.java:1085)
    at RUBY.(root)(<script>:1)

有没有人知道如何解决它?我在同一目录下build.xml和Rakefile。 $ {jruby.dir}指向提取的jruby目录。

0 个答案:

没有答案