Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 108923 - Can't change location of project when importing from an existing buildfile
Summary: Can't change location of project when importing from an existing buildfile
Status: RESOLVED DUPLICATE of bug 147337
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-Ant-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-07 08:55 EDT by David Leal CLA
Modified: 2012-10-31 01:02 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Leal CLA 2005-09-07 08:55:10 EDT
When I load a new project from an existing ant build file, by default eclipse 
assumes the location of the WorkSpace and nor the location of the build file: 
build.xml.

Such location can't be changed when you go to Properties of the project there 
is no way to change that, also de New Project Wizard doesn't allow you to 
change it.

Because that when invoking to build the project using ant it doesn't locate 
some source files.
Comment 1 Darin Swanson CLA 2005-09-30 07:47:12 EDT
Can you please explain what "load a new project" means? 
Are you talking about the basedir property when executing the Ant buildfile?
A small example demonstrating the problem would be appreciated.
Comment 2 David Leal CLA 2005-10-07 06:35:57 EDT
>Can you please explain what "load a new project" means? 
File|New|Project...

Then Select Java Project form Existing Ant Buildfile
Push Next button
Then, select the ant file to load on the box: Ant Build file
Push the Finish botton

Once the proyect is created, and you look on the properties of the project 
(right botton of the mouse and then Properties) the location of the project is 
inside the workspace directory. If you want to change this you have to change 
the workspace location (File|Switch workspace...), then Eclipse restart again. 
This is not a good solution, because it force to you to put the information on 
the workspace directory. There is no way to change the location of the 
generated project without swhithing the workspace location.

I expect on the loading process Eclipse allows me to pick the location of the 
project, some times you have the build files, and also the tree structure, I 
don't understand why such restriction about the workspace location.

The solution would be the put the build.xml file inside on the workspace 
location, BEFORE and then create the project from an existing ant build file.

Probably it is not a bug, just a functional restriction, but at the time a 
writing the bug I didn't know what is happened, I was thinking on my own 
location but there was information out of it.
Comment 3 Darin Swanson CLA 2005-10-07 10:13:46 EDT
Thank you for reporting back but I am still unsure of the nature of the problem.

When you create a Java project from an Ant buildfile, the project resources are 
linked to the actual location in the filesystem. The import does not copy the 
project source contents to the workspace but rather just makes resource links 
from the created Java project.
Comment 4 Jake P CLA 2005-11-03 12:16:30 EST
Creating the project from an existing Ant buildfile according to the
instructions below DOES copy the files to the workspace location.  Maybe we are
working with different versions?

Version: 3.1.0
Build id: I20050627-1435

Comment 5 David Leal CLA 2005-11-07 09:45:09 EST
I have downloaded the latest Eclipse version (today) in order to check it:
Version: 3.1.1
Build id: M20050929-0840

I get the same problem. The ant project I am trying to create I have 
downloaded from:

http://www.apress.com/book/supplementDownload.html?bID=405&sID=2447
(Sample Application of Pro Spring book, from Appres)

I have found ANOTHER PROBLEM: If you use <presetdef> ant feature (from 1.6.* 
version), for example:

<presetdef name="my.javac">
  <javac
    classpathref        = "compile.classpath"
    debug               = "${compile.debug}"
    deprecation         = "${compile.deprecation}"
    destdir             = "${build.classes.dir}"
    includeAntRuntime   = "no"
    failonerror         = "true"
    srcdir              = "${src.java.main.dir}"
    optimize            = "${compile.optimize}"
>
  <include name = "**/*.java"/>
</javac>
</presetdef>

and then you use it:

<target name="compile"
  description ="Compiles files">
  <!-- compiling source files-->
  <my.javac/>
  <!-- compiling testing files-->
  <my.javac
    srcdir  ="${src.java.test.dir}"
    destdir ="${build.testclasses.dir}"
  />
</target>

When you want to create a new project from an existing ant build file when you 
load the build.xml during the wizard process it doesn't allow you to go on, 
because it claims about there is no <javac> task. It should understand the 
<presetdef> type or al least to lead you specify the equivalent <javac> task.
Comment 6 Darin Swanson CLA 2006-02-13 18:23:39 EST
Logged new bug report 127593 for allow more than selection of just javac tasks.
Comment 7 Darin Swanson CLA 2007-02-26 20:51:24 EST
The planned support is to allow the user to link to the buildfile in its original location.

*** This bug has been marked as a duplicate of bug 147337 ***
Comment 8 孔 振 CLA 2012-10-31 01:02:32 EDT
 David Leal ,is the bug fixed?“It should understand the 
<presetdef> type or al least to lead you specify the equivalent <javac> task.”