[英]How to include maven dependency libraries in war file using Ant build
[英]Ant Build File and Libraries
我嘗試了多種方法來包括從屬庫。
我的項目取決於:
appframework-1.03.jar,swing-worker.jar和swing-layout罐子
這是我的構建文件:
<?xml version="1.0" encoding="UTF-8"?>
<project name="IvleFileSync" default="dist" basedir=".">
<description>
simple example build file
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="build" location="build"/>
<property name="dist" location="dist"/>
<path id="files-classpath">
<fileset dir="/usr/lib" >
<include name="*.jar"/>
</fileset>
</path>
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build}"/>
</target>
<target name="compile" depends="init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${build} -->
<javac srcdir="${src}" destdir="${build}"/>
<classpath>
<path refid="files-classpath" />
<path location="/usr/lib/swing-layout-1.0.3.jar"/>
<path location="/usr/lib/swing-worker-1.1.jar"/>
<path location="/usr/lib/appframework-1.03.jar"/>
</classpath>
</target>
<target name="dist" depends="compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
<jar jarfile="${dist}/lib/IvleFileSync-${DSTAMP}.jar" basedir="${build}"/>
</target>
<target name="clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build}"/>
但是無法編譯源
它總是拋出org.jdesktop.application包不存在的錯誤。
我把我所有的罐子放在“ / usr / lib”下
您在定義其類路徑之前關閉了Javac任務:
<javac srcdir="${src}" destdir="${build}"/>
<classpath>...
^-- javac is closed here.
替換為
<javac srcdir="${src}" destdir="${build}">
<classpath>...</classpath>
</javac>
並且無需將jar兩次添加到類路徑。 您可以使用<path refid=
將它們包括在內,然后通過列出罐子來包含它們。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.