자바 프로젝트에 외부 jar를 포함하고 싶습니다. 개미를 사용하고 있습니다. 외부 .jar는 폴더 lib에 있습니다. 내 build.xml은 다음과 유사합니다.개미가 외부 .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>
그러나 작동하지 않습니다. 외부 .jar 파일을 가져 오려고 할 때 ant compile
명령 뒤에 오류가 있습니다. com.something 패키지가 없습니다. 제대로 작동하려면 무엇을 편집해야합니까?
정확한 오류 :
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
정확한 오류를 제공하도록 질문을 편집 할 수 있습니까? – Tom
정확한 오류를 추가했습니다. – Pajushka
일반 병에 외부 라이브러리를 쉽게 포함 할 수 없습니다. 이를 달성하려면 원 항아리 같은 특별한 작업이 필요합니다. – oers