Quiero incluir jar externo a mi proyecto de Java. Estoy usando hormiga External .jar está en la carpeta lib. Mi build.xml se ve algo así:Ant incluye externa .jar
<?xml version="1.0" encoding="UTF-8"?>
<project>
<path id="classpath">
<fileset dir="lib" includes="**/*.jar"/>
</path>
<target name="clean">
<delete dir="build"/>
</target>
<target name="compile">
<mkdir dir="build"/>
<javac srcdir="src" destdir="build" classpathref="classpath" />
</target>
<target name="jar">
<mkdir dir="trash"/>
<jar destfile="trash/test.jar" basedir="build">
<zipgroupfileset dir="lib" includes="**/*.jar"/>
<manifest>
<attribute name="Main-Class" value="com.Test"/>
</manifest>
</jar>
</target>
<target name="run">
<java jar="trash/test.jar" fork="true"/>
</target>
</project>
Pero no funciona. Cuando quiero importar algo del archivo .jar externo, aparece un error después del comando ant compile
: paquete com.algo no existe. ¿Qué debo editar para que funcione?
error exacto:
Compiling 23 source files to xy/build
xy/src/com/Test.java:5: package com.thoughtworks.xstream does not exist
import com.thoughtworks.xstream.*;
^
1 error
¿Puede editar su pregunta para proporcionarnos el error exacto? – Tom
He agregado el error exacto. – Pajushka
no puede incluir bibliotecas externas fácilmente en un contenedor normal. Necesita tareas especiales como one-jar para lograr eso. – oers