admin管理员组

文章数量:1123933

I've very recently begun working with Ant as my primary buildtool, and have been enjoying it so much that I really would rather stick with it for a while. The only frustrating issue I've run into is when it comes to integrating dependency management with Ivy. The retrieval process goes fine, and all of the necessary JARs are successfully downloaded into an autogenerated library folder called 'lib.' The issue, then, comes during the compilation process. Without fail, the compiler returns errors for every instance of a jar-dependent class (or jar import statement) found in the code.

file tree (.png)

build.xml

<project xmlns:ivy="antlib:org.apache.ivy.ant" name="CELLMAX" default="run">

<target name="resolve">
    <ivy:retrieve/>
</target>

<target name="compile">
    <mkdir dir="classes"/>
    <mkdir dir="jars"/>
    <javac srcdir="src" destdir="classes"/>
    <jar destfile="jars/CELLMAX.jar" basedir="classes">
        <manifest>
            <attribute name="Main-Class" value="main.java.Driver"/>
        </manifest>
    </jar>
</target>

<target name="run">
    <java jar="jars/CELLMAX.jar" fork="true"/>
</target>

</project>

sample error log

[javac] /home/pablo/javar/CELLMAX/src/main/java/Reader.java:4: error: package org.openqa.selenium does not exist

[javac] import org.openqa.selenium.By;

I've tried changing (and deleting) the import statements altogether, moving the lib folder into the .java file directory and having them point to the jars via the lib folder, all with no success. Does anyone have any idea what might be preventing the compiler from automatically identifying jars within the lib folder? Does Ant not have any such feature? Attached below are my project file tree, buildfile, and compiler error logs.

本文标签: