Common targets are not recognized by Eclipse
Asked Answered
A

4

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?

Araarab answered 16/11, 2009 at 15:50 Comment(1)
Did you ever figure out a workaround for this? I'm seeing this issue in my current version of eclipse helios.Cellulose
M
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.

Mathew answered 30/10, 2012 at 10:29 Comment(0)
T
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.

Thankless answered 16/11, 2009 at 16:2 Comment(1)
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 galileoAraarab
H
0

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

Habitation answered 16/11, 2009 at 15:52 Comment(3)
forgot to mention, i add import file="${basedir}/common/common.xml" in build.xmlAraarab
I have a common directory included as an svn:external. Nearly the same setup as you. My build file is simply: <project name="ProjectName" default="package"> <import file="common/build/common-targets.xml" /> </project> What ANT runtime are you using within eclipse. I am using 1.7.1.v20090120-1145Thankless
Ah, yes, the Ant runtime could have an effect. Other than that, I'm stumped.Habitation
C
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.

Cellulose answered 21/10, 2010 at 13:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.