开发者

how should the compilation be done to be included in ant _home lib for .class and java file

i have a problem ant script:

<taskdef name="CFileEdit" classname="com.ANT_Tasks.CFileEdit"/>

where taskdef class com.ANT_Tasks.CFileEdit cannot be found

now i have CFileEdit.java and i did this:

  1. CFileEdit.java开发者_C百科 compiled into CFiledEdit.class
  2. CFileEdit.class into CFileEdit.jar
  3. Place CFileEdit.jar into ANT_HOME\lib?

I am not sure if step 3 is correct. I do not wish to add a path in my ant script. Thanks


You can specify a classpath for the taskdef (example for svnkit):

<taskdef name="svnkit" 
    className="org.tigris.subversion.svnant.SvnTask"
    classpathref="svnkit.classpath" />

  <path id="svnkit.classpath">
    <fileset dir="${3rd.lib.dir}/svnant/svnant/1.3.0/" >
      <include name="*.jar" />
    </fileset>  
  </path>

-EDIT- If you don't want to alter the taskdef you can choose one of the following options to place the jar (from : http://ant.apache.org/manual/install.html):

In ANT_HOME/lib. This makes the JAR files available to all Ant users and builds.

In ${user.home}/.ant/lib (as of Ant 1.6). This allows different users to add new libraries to Ant. All JAR files added to this directory are available to command-line Ant.

On the command line with a -lib parameter. This lets you add new JAR files on a case-by-case basis.

In the CLASSPATH environment variable. Avoid this; it makes the JAR files visible to all Java applications, and causes no end of support calls. See below for details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜