Ant build fails due to unfound imports in other projects

I have a java project which imports and uses classes in other projects. I am able to successfully build this project in eclipse. From eclipse I then exported an Ant Buildfile, build.xml. If I attempt to run this file with eclipse or via cmd prompt it fails.

One of the many import reported error is:
[javac] H:...sortedprovidablemanagertestSimpleObject.java:8: error: package com.rock.common.core.providable.abstractions does not exist
[javac] import com.rock.common.core.providable.abstractions.AProvidable;

How do I tell Ant to import required classes. I'm guessing these are dependencies. But clearly I'm having trouble setting it up correctly.


In the build.xml, there will be a <javac> task. <javac> takes either a classpath attribute or a nested <classpath> element. Here's an example with a nested <classpath> element:

<javac ...>
    <classpath>
        <pathelement location="PATH_TO_THE_CLASS_FILES_ROOT_DIRECTORY"/>
    </classpath>
    ...
</javac>

The classpath tells the Java compiler where to find the binary dependencies it needs.

链接地址: http://www.djcxy.com/p/44384.html

上一篇: 使用现有的ant build.xml文件创建一个eclipse项目

下一篇: 由于在其他项目中导入不正确,Ant构建失败