Community
Participate
Working Groups
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.
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.
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.
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?
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.
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?
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)?
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?
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.
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?
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.
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.
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?
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.
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.