Re: Javac Run By Ant Script is Unable to Find External Jars

Dennis Putnam <[email protected]>
Newsgroups gmane.comp.jakarta.ant.user
Message-ID <[email protected]>
Hi Jaikiran,

Thanks for the reply. I thought the classpath parameter defaulted to
"basedir"/.classpath. In any case I made the following change:

<javac srcdir="src" destdir="bin" includeantruntime="false" classpath=".classpath" />


Unfortunately that didn't help. The ant output is exactly the same. FWIW
here is .classpath:

    <?xml version="1.0" encoding="UTF-8"?>
    <classpath>
            <classpathentry including="**/*.java" kind="src"
    output="target/classes" path="src">
                    <attributes>
                            <attribute name="optional" value="true"/>
                            <attribute name="maven.pomderived"
    value="true"/>
                    </attributes>
            </classpathentry>
            <classpathentry kind="con"
    path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
                    <attributes>
                            <attribute name="maven.pomderived"
    value="true"/>
                    </attributes>
            </classpathentry>
            <classpathentry kind="lib"
    path="/lib/java-ext/json-simple-1.1.1/json-simple-1.1.1.jar"/>
            <classpathentry kind="con"
    path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
                    <attributes>
                            <attribute name="maven.pomderived"
    value="true"/>
                    </attributes>
            </classpathentry>
            <classpathentry kind="output" path="target/classes"/>

The "lib" path is correct. I am guessing that the next tag essentially
points the pom.xml so here it is in case it matters:

    <project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
    http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>KCBSEvents</groupId>
      <artifactId>KCBSEvents</artifactId>
      <version>0.0.1-SNAPSHOT</version>
      <build>
        <sourceDirectory>src</sourceDirectory>
        <resources>
          <resource>
            <directory>src</directory>
            <excludes>
              <exclude>**/*.java</exclude>
            </excludes>
          </resource>
        </resources>
        <plugins>
          <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.7.0</version>
            <configuration>
              <source>1.7</source>
              <target>1.7</target>
            </configuration>
          </plugin>
        </plugins>
      </build>
       <dependencies>
            <dependency>
                    <groupId>org.apache.httpcomponents</groupId>
                    <artifactId>httpclient</artifactId>
                    <version>4.5.6</version>
            </dependency>
            <dependency>
                    <groupId>commons-io</groupId>
                    <artifactId>commons-io</artifactId>
                    <version>2.5</version>
            </dependency>
            <dependency>
                    <groupId>org.apache.httpcomponents</groupId>
                    <artifactId>httpcore</artifactId>
                    <version>4.4.10</version>
            </dependency>
            <dependency>
                    <groupId>commons-codec</groupId>
                    <artifactId>commons-codec</artifactId>
                    <version>1.10</version>
            </dependency>
            <dependency>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                    <version>1.2</version>
            </dependency>
       </dependencies>

Presumably the maven libraries are found from the zipfilesets in the ant
script.

On 2/14/2019 8:55 AM, Jaikiran Pai wrote:
> Hi Dennis,
>
> On 13/02/19 11:56 PM, Dennis Putnam wrote:
>> <javac srcdir="src" destdir="bin" includeantruntime="false" />
>
> I don't see any classpath being passed to the javac task in your build
> script. You should be passing a classpath containing your jars that are
> required to compile the source. There's more than one way to do that.
> The javac task manual has more details about it
> https://ant.apache.org/manual/Tasks/javac.html
>
>
> -Jaikiran
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>
signature.asc (application/pgp-signature, 196 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)

iEYEARECAAYFAlxlflYACgkQ/fiWYqZ2tVTuIQCgiN0gRAqEvllyK0JcBY88oH34
Sz8AoKFq0IdGmLa6MtyKd0X/SFv51CRR
=h6RE
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.