eclipse adding java ant based project: Specified buildfile does not contain a javac task

3

I have a project that i wrote for apache tomcat. I started working with eclipse i want to import the project to eclipse ide.

using eclipse 3.6.1.

when i create a new project using :

File -> New -> Other -> Java -> Java Project from Existing Ant Buildfile and i provide the build file location i get the following error:

Specified buildfile does not contain a javac task

I have a red5 project that i used the same method and it worked. what am i missing? do i need to add something to the ant build file to make it work? what exactly ? where can i find more information regarding this specific subject ?

thanks!

ufk

Posted 2010-11-21T18:13:48.357

Reputation: 1 055

Answers

3

I have run into the same problem. Eclipse is looking for the javac, and the present version doesn't know how to unravel it.

My build.xml calls other ant files. An excerpt looks like this:

  <target name="MyProject">
    <ant antfile="project.xml" target="${tgt}">
      <property name="project_name" value="MyProject"/>
      <property name="root_project_dir" value="${root_dir}/SubProj/src"/>
      <property name="cvsroot" value="${cvsroot_SubProj}"/>
      <property name="cvsmodule" value="${cvsmodule_SubProj}/src/MyProject"/>
    </ant>
  </target>

I added a javac task between the </ant> and </target> lines:

<javac srcdir="${root_dir}/SubProj/src" destdir="C:\temp"/>

This gave Eclipse the information it needed: how to find the source files for SubProj. The javac task indicated the directory.

Unfortunately, Eclipse also added a SubProj.src to the package names. I don't know of a way to fix this other than Ctrl-1 on the package name, but this messes up the CVS saves.

rajah9

Posted 2010-11-21T18:13:48.357

Reputation: 286

In my case, the javac task was in a macro with parameters that is being invoked from the compile task. I had to workaround by making a copy of the task that inlines the macro. – haridsv – 2015-02-23T12:23:55.373