8

I have added all common targets like (init, clean, getivy, etc) in ./common/common.xml and added:

<import file="${basedir}/common/common.xml"/>

in build.xml.

When I build the project, its working fine. But, When I open build.xml in Eclipse IDE, I see some "Red" marks underneath targets which have a dependency targets that are defined in common.xml. And when I do mouse over those Red marked targets, I see a message saying that:

Target init does not exist in this project.

To clarify, the common folder is added through svn:externals. Does this need extra configurations in Eclipse?

kenorb
  • 155,785
  • 88
  • 678
  • 743
Angrezy
  • 141
  • 2
  • 10
  • Did you ever figure out a workaround for this? I'm seeing this issue in my current version of eclipse helios. – jtruelove Oct 20 '10 at 21:35

4 Answers4

2

I have Eclipse Indigo Service Release 1 Build id: 20110916-0149 with ant 1.8.2 and the described problem with import seems to be fixed as Steve already mentioned. But the problem still exists for include and no answer seems to solve it for me. I searched the bugtracker shortly but don't have the time to be sure and test in the latest eclipse version and post a bug in the bugtracker.

Edit: I had the problem with import again after refactoring the folder structure in the project and moving the buildfile. Although I started "Validate" on the project, the validation cached the old location and did'nt realize the move. I had to close the editor and the warning disappeared.

jan
  • 2,741
  • 4
  • 35
  • 56
1

If your build.xml, and the common directory are at the same directory level then just try

<import file="common/common.xml" />

This works for me fine.

kenorb
  • 155,785
  • 88
  • 678
  • 743
Steve
  • 53,375
  • 33
  • 96
  • 141
  • I tried that one too. In either of the cases i am able to build the project, but why eclipse is not recognizing the common targets when i open build.xml. I am using Eclipse ganymede 3.4.2 I also tried in galileo – Angrezy Nov 16 '09 at 16:08
0

Use the include path ${basedir}/common/common.xml because . is probably the directory in which Eclipse is installed.

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
  • forgot to mention, i add import file="${basedir}/common/common.xml" in build.xml – Angrezy Nov 16 '09 at 15:57
  • I have a common directory included as an svn:external. Nearly the same setup as you. My build file is simply: What ANT runtime are you using within eclipse. I am using 1.7.1.v20090120-1145 – Steve Nov 16 '09 at 18:47
  • Ah, yes, the Ant runtime could have an effect. Other than that, I'm stumped. – Aaron Digulla Nov 16 '09 at 20:15
0

I found a post online here where someone found a workaround. You just need to make the file import not the first line in the ant build file. If you put it after a property declaration for instance the error goes away. This worked fine for me and eclipse is happy now.

The specific problem we had seemed to be because we were importing common build.xml files into our project-specific build files, but the import was having problems when it is the first line in our project-specific build file.

However, if I put a property task before the import, it seems to work fine. I am guessing this much force some initialization that wasn't occurring with only the <import>. I have no idea why this same issue doesn't happen in either command line with Ant 1.8, or with Eclipse using Ant 1.7.

kenorb
  • 155,785
  • 88
  • 678
  • 743
jtruelove
  • 3,306
  • 3
  • 25
  • 29