| Summary: | After ANT task compiles - Eclipse project shows lots of errors when running App | ||
|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | MH <mhilpert> |
| Component: | Core | Assignee: | JDT-Core-Inbox <jdt-core-inbox> |
| Status: | CLOSED WONTFIX | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | CC: | jarthana, sptaszkiewicz, srikanth_sankaran, stephan.herrmann |
| Version: | 4.3.1 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | stalebug | ||
|
Description
MH
When you launch ant, have you selected anything on the "Refresh" tab? Another option to (un?)check: Run/Debug > Launching > [x] Build (if required) before launching. I assume that your launches perform a build on only partly refreshed resources, hence the garbage. On a different note, I'd expect you'd get better results by letting Eclipse do the compilation and using ant only for packaging into jars, this might significantly reduce the time you have to wait for building - and provides for a clean separation of responsibilities. Nope, the Refresh tabs don't have "Refresh resources upon completion" checked. Where is "Run/Debug > Launching > "? We don't use Eclipse for compilation before makeing JARs because we have misc ANT tasks to compile with different compiler parameters. This still occurs with eclipse-java-kepler-SR2-win32-x86_64.zip. The project is clean - when I Eclipse-Clean the project: no errors. Then I call my custom ANT target (out of Eclipse's ANT view) to create a JAR file from my project. In about 30% of those cases, the Eclipse Java project suddenly shows compiler errors. When I just clean the Eclipse project, the errors vanish. This error occurs several dozen times a day which makes development very frustrating (as we constantly deploy JARs on the development server). When I wait a minute between Eclispe compilation/clean and starting my ANT target, the error never occurs. So, this is a threading issue with Eclipses internal cleans/refreshes/whatever and the custom ANT target that also compiles the source files and creates a JAR. Even though I have "Build Automatically" switched OFF, Eclipse seems to somehow compile/check/whatever the class filesright when my ANT target compiles the same source files (of course to the same output class folder). (In reply to MH from comment #2) > Nope, the Refresh tabs don't have "Refresh resources upon completion" > checked. My question was meant as a hint: try *enabling* this option to see if this gets your workspace in sync with the filesystem and thus avoids the garbage. > Where is "Run/Debug > Launching > "? In the preferences I already have "Build (if required) before launching" enbaled => bug still occurs. (In reply to MH from comment #5) > I already have "Build (if required) before launching" enbaled => bug still > occurs. This option is more likely to *contribute* to the problem than fixing it. *Unchecking* could perhaps help. However, the main hint I gave regards "refresh" not "build". Have you tried that?? Okay, I now checked all boxes on the ANT refresh tab. Today, the error didn't occur anymore. Hope, this was the reason! But I don't understand that I have to check the refreshing ... without refreshing, Eclipse should do nothing. But it does mark most files with thousands of errors. So, this means that Eclipse is doing SOMETHING ... This looks by design, Passing to Platform for confirmation. It seems that the Ant task modified some workspace content and then a refresh is needed to put it back in-sync. I can't tell why errors are shown without refresh but it means the Java builder was run and found some (potentially dubious) errors. I guess it depends what are these errors about. There is nothing more we can do without a reproducible test case. (In reply to MH from comment #3) > This still occurs with eclipse-java-kepler-SR2-win32-x86_64.zip. The project > is clean - when I Eclipse-Clean the project: no errors. Then I call my > custom ANT target (out of Eclipse's ANT view) to create a JAR file from my > project. In about 30% of those cases, the Eclipse Java project suddenly > shows compiler errors. When I just clean the Eclipse project, the errors > vanish. Does the JAR created related to the project or it's classpath in any way? Where do the classes compiled by the ANT task go? Can you try making it use a location outside the folder for output, just in case? The projects don't create the JARs only the class files. The ANT task for each project compiles the same source files from the eclipse project, creates the same class files as the Eclipse project and creates the JAR (that is not related in the Eclipse project). So, the critical part seems to be the class files. The ANT task basically does: 1. delete class files 2. compile sources to recreate the class files 3. create JAR from these class files SOmehow, Eclipse is doing things in the background and perhaps, when the class files are deleted get somehow "out of sync" and goes crazy. But once the project is marked with hundreds of errors, it never turns back again clean - even when the ANT tasks is finished and the class files are recreated. I have to do a "clean project" manually. (In reply to MH from comment #0) > BTW: we deactivated "build automatically"! Are things any different/better when it's turned on? Nope, it gets worse. I guess it's simple: Eclipse does not sync with the ANT view and its running tasks. (In reply to MH from comment #13) > Nope, it gets worse. I guess it's simple: Eclipse does not sync with the ANT > view and its running tasks. I don't know what might be going on. I also can't promise much time for this as of now. Meanwhile, may I suggest a workaround of having ANT create the .class files in a location outside project's classpath if the goal is only to create the JARs? I think that should work. This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug. If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie. |