Bug 82375 - Missing source folder causes build to fail
Summary: Missing source folder causes build to fail
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 3.1 M5   Edit
Assignee: Kent Johnson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-07 07:59 EST by Nikolay Metchev CLA
Modified: 2005-01-10 15:17 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nikolay Metchev CLA 2005-01-07 07:59:55 EST
If you import a new project and the .classpath specifies a source folder which
doesn't exist the build fails. This is very annoying because in our case these
folders are where automatically generated code goes. You have to click on
properties of the project and then choose the sources section which then
automatically creates the folders. This is tedious and unecessary.
I think that if this situation arises eclipse should either:
a) Prompt the user whether they want that folder created or not
b) Automatically create the folder
c) Have the option of both a and b.
Comment 1 Kent Johnson CLA 2005-01-08 09:56:33 EST
Does this only happen with auto-gen'ed code?

If so, when is the code the generated?

It should be before the JavaBuilder is run.
Comment 2 Nikolay Metchev CLA 2005-01-08 10:47:15 EST
The build always fails if the source folders are missing. Unfortunately the 
way the code is generated is by running a java application launch 
configuration. I did request in bug 38407 to be able to run it as part of the 
build but it seems that nobody thinks it is important to be able to do so.
Comment 3 Kent Johnson CLA 2005-01-10 08:09:42 EST
I must be missing something.

Why is the gen'ed code not created by a builder, like an Ant builder (which is 
scheduled to run before the Java Builder)?

Why write a separate app when you can just plug in your own builder?
Comment 4 Nikolay Metchev CLA 2005-01-10 08:43:48 EST
Fair point.
We don't really use ant too much so that is why I never considered. However even
though there is a workaround to my particular problem it doesn't mean that
missing source folders should fail the build.
Comment 5 Kent Johnson CLA 2005-01-10 10:12:45 EST
Its not really a workaround - its the expected method for generating source.

As a result, missing source folders are considered an error that we do not 
want to silently ignore.

Say we did create the missing source folder, there are still no generated 
types in the folder. So we go from 1 build failure to numerous compile errors 
that may cause even more confusion if the source was generated after the Java 
Builder had finished.

Would you not agree that 1 build failure is easier to track down than numerous 
missing type errors, especially for types that now eaily found?
Comment 6 Nikolay Metchev CLA 2005-01-10 11:20:58 EST
Good point.

We have already agreed that your solution to the auto-generated code is best.

What if the missing source folders do not contain necessary files for the build
(e.g. xml configuration files which are only required at runtime)?



Comment 7 Kent Johnson CLA 2005-01-10 11:37:47 EST
Runtime only files do not need to be in a 'source' folder, especially one that 
does not contain any source.

Since we cannot always tell what the user is doing, I think we'll have to 
assume that missing source folders are an error case, which we must inform the 
user about.

Ok to close?
Comment 8 Nikolay Metchev CLA 2005-01-10 11:52:30 EST
I do sometimes exploit the fact that non-java items in source folders get copied
into the binary directory. That is why runtime-files need to be in a "source"
folder. I then set my working directory to the binary directory and all
configurations files from all source folders are picked up.
Comment 9 Kent Johnson CLA 2005-01-10 12:34:34 EST
That's fine but for them to be copied, the source folder & the files must 
exist before the Java Builder runs.

So would you consider it an error if this source folder (& these files) didn't 
exist at build time?
Comment 10 Nikolay Metchev CLA 2005-01-10 12:57:58 EST
It could go either way. 
Some applications are able to cope with missing configuration files, some
applications are not. For example in eclipse itself if the "configuration"
folder is missing from the installation it is created automatically.
Comment 11 Nikolay Metchev CLA 2005-01-10 12:59:07 EST
P.S. if you go the source folders section in the build properties of the project
it tells you that it will automatically create any missing source folders. It
seems to be inconsistant with the build process.
Comment 12 Kent Johnson CLA 2005-01-10 13:36:22 EST
Its not inconsistent, because the source folders are created as the user 
maniuplates the classpath in that dialog. Its not a build operation, its a 
project setup issue.

I still don't see how you are better off if the builder did create the source 
folder. Your generated files won't be gen'ed in time, so how does this help 
you?
Comment 13 Nikolay Metchev CLA 2005-01-10 14:31:24 EST
My point was that the generated files may not be necessary for the build. If 
you just want to run the application it wont happen because nothing will get 
compiled.
Comment 14 Kent Johnson CLA 2005-01-10 15:17:24 EST
To summarize:

1. Missing source folders only happen because a user edits the .classpath file 
himself, normally they are created during project setup. Its not a stretch to 
say that a user who edits the .classpath file can also create the new source 
folders.

2. We have to balance the case that the missing source folder means large 
numbers of types are not available (1 error is better than 100's) vs. the case 
that the missing source folder would not contain any types or resources needed 
before the build (in which case it likely didn't need to be a source folder at 
all).

3. The expected method of generated code is write an Ant builder task and 
schedule it to run before the Java Builder.

So I think we'll leave our behaviour as is.