What's wrong with this Ant path?

2019-08-28 00:45发布

问题:

Note: even though this question involves GWT, it's really an Ant question. All I'm asking is: is the Ant PATH that I have below a "legal" path?

I am getting ClassNotFoundExceptions on a type (com.google.gwt.dev.Compiler) that is packaged inside gwt-dev.jar (which as you can see is configured to be on the path below). Does the gwt.path look wrong to anyone:

<path id="gwt.path">
    <pathelement location="${gen.bin.main.dir}"/>
    <fileset dir="${gen.lib.main.dir}">
        <filename name="gin-2.1.2.jar"/>
        <filename name="guice-3.0.0.jar"/>
        <filename name="guice-assistedinject-3.0.0.jar"/>
        <filename name="gwt-bootstrap-2.2.2.jar"/>
        <filename name="gwt-bootstrap-sources-2.2.2.jar"/>
        <filename name="gwt-dev.jar"/>
        <filename name="gwt-user.jar"/>
        <filename name="javax-inject-1.0.0.jar"/>
        <filename name="requestfactory-apt.jar"/>
        <filename name="requestfactory-client+src.jar"/>
        <filename name="validation-api-1.0.0.GA.jar"/>
        <filename name="validation-api-1.0.0.GA-sources.jar"/>
    </fileset>
</path>

If now then I will explore other avenues.

回答1:

To see if an ant path is correct use the ant touch command:

<touch file="myfile"/>

This is similar to the unix touch command and should create an empty file named myfile in that path, if the path is correct.

In this case, are you trying to add some jars to the classpath? In that case you should use the classpath element and not path.



回答2:

I figured it out. It was bad Ant. All the <fileset> elements need to be <pathelement location="the-jar"/> instead.