This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 120843 - Build fails after unsuccessful clean build
Summary: Build fails after unsuccessful clean build
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on:
Blocks: 104508
  Show dependency tree
 
Reported: 2007-11-01 16:45 UTC by mclaassen
Modified: 2007-11-06 16:34 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Ant debug (184.63 KB, application/x-compressed)
2007-11-05 16:57 UTC, mclaassen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mclaassen 2007-11-01 16:45:26 UTC
I have been unable to reproduce this using a trivial project, but this happens every time to me in my production
environment.

What I do is a clean build.  If that fails because of compiler errors and I fix those, subsequent builds will fail. 

This is what I see when I do a clean build:
init:
deps-clean:
Deleting directory C:\dsi\Netbeans\NB6\MainLine\JavaOcie\projects\JavaViewer\build
clean:
init:
deps-jar:
Created dir: C:\dsi\Netbeans\NB6\MainLine\JavaOcie\projects\JavaViewer\build\classes
Compiling 2702 source files to C:\dsi\Netbeans\NB6\MainLine\JavaOcie\projects\JavaViewer\build\classes

Then I get compile error.
So, I fix them and do a build (from the toolbar)

Now I see:
init:
deps-jar:
Compiling 25 source files to C:\dsi\Netbeans\NB6\MainLine\JavaOcie\projects\JavaViewer\build\classes

So I see a huge amount of compile errors like:

package dsi.client.awt does not exist
cannot find symbol
...

At this point, everything is compilable, but the build just won't do it.  If I now go to the root of my file tree and
hit F9, I get:
init:
deps-jar:
Compiling 2702 source files to C:\dsi\Netbeans\NB6\MainLine\JavaOcie\projects\JavaViewer\build\classes
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
copy-to-build:
Copying 419 files to C:\dsi\Netbeans\NB6\MainLine\JavaOcie\projects\JavaViewer\build\classes
compile-single:
BUILD SUCCESSFUL (total time: 1 minute 4 seconds)

This time the compile-single compiled all the files, but it does not always.  Often it will say that it is only
compiling less X file where X < 2702

This is pretty frustrating for me.  I am sorry I can't give you a good test case right now, but it happens every time in
my environment, so I wonder if it will on yours to when on a non-trivial project.

The started happening around Beta2.  I am, using daily 200710310000
Comment 1 Peter Pis 2007-11-04 14:36:04 UTC
Reassigning to "ant".
Comment 2 Milan Kubec 2007-11-04 21:57:05 UTC
Please, provide more information about what kind of project is that and how it was created, describe also layout of the
project, what libraries it uses, etc. Switch Ant to Verbose verbosity level (Tools | Options | Miscellaneous | Ant) and
attach output from Output Window. Thanks.
Comment 3 Milan Kubec 2007-11-05 07:33:31 UTC
More information is needed to resolve the issue.
Comment 4 Jesse Glick 2007-11-05 11:00:23 UTC
Clearly using a j2seproject. But yes, need a test case to reproduce or I cannot likely do anything. Running Ant in
Verbose mode might turn up something useful, but probably will not.

After fixing the erroneous code, does Clean & Build (as opposed to Build) work?

Best to attach information _now_ because there is little time for further fixes to 6.0.
Comment 5 mclaassen 2007-11-05 16:56:24 UTC
Strangely, it seems to work the 3rd time.  The behavior is pretty repeatable, however sometimes it will work the 2nd
time.  This happens with files in different directories and with different CVS states (Local, Locally Modified)

I am sorry I have not been able to create a small reproducible test case.  I have tried.

Additional info
---------------

If you see some additional output you do not recognize, it is some debug echos that I added:
Config = DEV_04_07
Platform: Java_1.6.0

Turing on ANT debug I get some more info.  (Lots more, actually...)
Look at the differences between builds 2 and 3, I get this:

build 2
-------
Line 39:  Setting ro project property: includes -> dsi/client/wizard2/test/TestWizard.java
This is not in build 3

build 2
-------
Build 2, Line 452: Override ignored for property "includes"
Build 3, Line 451: Setting project property: includes -> **

Build 2, Line 616: fileset: Setup scanner in dir C:\dsi\Netbeans\NB6\MainLine\JavaOcie\projects\JavaViewer\src with
patternSet{ includes: [dsi/client/wizard2/test/TestWizard.java] excludes: [] }
Build 3, Line 615: fileset: Setup scanner in dir C:\dsi\Netbeans\NB6\MainLine\JavaOcie\projects\JavaViewer\src with
patternSet{ includes: [**] excludes: [] }

Here is something else.  I am recording everything I am going here and look how the number of files it is going to
compile changes:

Config = DEV_04_07
Platform: Java_1.6.0
init:
deps-clean:
Deleting directory C:\dsi\Netbeans\NB6\MainLine\JavaOcie\projects\JavaViewer\build
clean:
Config = DEV_04_07
Platform: Java_1.6.0
init:
deps-jar:
Created dir: C:\dsi\Netbeans\NB6\MainLine\JavaOcie\projects\JavaViewer\build\classes
Compiling 2717 source files to C:\dsi\Netbeans\NB6\MainLine\JavaOcie\projects\JavaViewer\build\classes
C:\dsi\Netbeans\NB6\MainLine\JavaOcie\projects\JavaViewer\src\dsi\ext\textviewer\client\plugable\DocumentPluginImpl.java:155:
not a statement
                return isGreenBarEnabled; bogus
                                          ^
C:\dsi\Netbeans\NB6\MainLine\JavaOcie\projects\JavaViewer\src\dsi\ext\textviewer\client\plugable\DocumentPluginImpl.java:155:
';' expected
                return isGreenBarEnabled; bogus
                                               ^
2 errors
BUILD FAILED (total time: 12 seconds)

Config = DEV_04_07
Platform: Java_1.6.0
init:
deps-jar:
Compiling 2717 source files to C:\dsi\Netbeans\NB6\MainLine\JavaOcie\projects\JavaViewer\build\classes
C:\dsi\Netbeans\NB6\MainLine\JavaOcie\projects\JavaViewer\src\dsi\ext\textviewer\client\plugable\DocumentPluginImpl.java:155:
not a statement
                return isGreenBarEnabled; bogus
                                          ^
C:\dsi\Netbeans\NB6\MainLine\JavaOcie\projects\JavaViewer\src\dsi\ext\textviewer\client\plugable\DocumentPluginImpl.java:155:
';' expected
                return isGreenBarEnabled; bogus
                                               ^
2 errors
BUILD FAILED (total time: 12 seconds)

Config = DEV_04_07
Platform: Java_1.6.0
init:
deps-jar:
Compiling 2717 source files to C:\dsi\Netbeans\NB6\MainLine\JavaOcie\projects\JavaViewer\build\classes
C:\dsi\Netbeans\NB6\MainLine\JavaOcie\projects\JavaViewer\src\dsi\ext\textviewer\client\plugable\DocumentPluginImpl.java:155:
not a statement
                return isGreenBarEnabled; bogus
                                          ^
C:\dsi\Netbeans\NB6\MainLine\JavaOcie\projects\JavaViewer\src\dsi\ext\textviewer\client\plugable\DocumentPluginImpl.java:155:
';' expected
                return isGreenBarEnabled; bogus
                                               ^
2 errors
BUILD FAILED (total time: 13 seconds)


Fix the bug, press the save all toolbar button

Config = DEV_04_07
Platform: Java_1.6.0
init:
deps-jar:
Compiling 1 source file to C:\dsi\Netbeans\NB6\MainLine\JavaOcie\projects\JavaViewer\build\classes
C:\dsi\Netbeans\NB6\MainLine\JavaOcie\projects\JavaViewer\src\dsi\ext\textviewer\client\plugable\DocumentPluginImpl.java:12:
package dsi.client.awt does not exist
import dsi.client.awt.DPanel;

<snip>
                                           ^
100 errors
BUILD FAILED (total time: 3 seconds)

Config = DEV_04_07
Platform: Java_1.6.0
init:
deps-jar:
Compiling 2717 source files to C:\dsi\Netbeans\NB6\MainLine\JavaOcie\projects\JavaViewer\build\classes
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
Copying 420 files to C:\dsi\Netbeans\NB6\MainLine\JavaOcie\projects\JavaViewer\build\classes
compile:
BUILD SUCCESSFUL (total time: 1 minute 10 seconds)





Comment 6 mclaassen 2007-11-05 16:57:35 UTC
Created attachment 52538 [details]
Ant debug
Comment 7 Jesse Glick 2007-11-05 19:18:23 UTC
I think I found a test case.

---%<--- C1.java
public class C1 {}
---%<--- C2.java
public class C2 {
    C1 v;
}broken
---%<---

1. Clean & Build => error in C2.java

2. Delete 'broken' from C2.java

3. Build =>

/tmp/JavaLibrary20/src/C2.java:2: cannot find symbol
symbol  : class C1
location: class C2
    C1 v;
1 error
BUILD FAILED (total time: 0 seconds)

Build in this case passes just C2.java to javac. (Because of the optimization in issue #104508.) F9 on C2.java does
work, but that is because F9 uses a sourcepath and Build (because of issue #49026) does not. Since C1.java is
uncompiled, javac on C2.java cannot find it either as source as binary.

Probable fix is to disable the optimization of issue #104508 in case the previous build failed.
Comment 8 Jesse Glick 2007-11-05 19:20:56 UTC
Simple workaround, in case this was not already obvious, is to just use Clean & Build rather than Build after fixing the
compilation error.
Comment 9 mclaassen 2007-11-05 20:12:19 UTC
I am glad you have found a test case.  

I have just had this happen to me in my more normal routine...without doing a clean at all.  This makes the suggested
workaround a bit of time-waster.  Clean builds just take too long.  The workaround I am now using is just to keep trying
the build until it eventually works the way it should. (Usually on 1 or 2 extra builds.)
Comment 10 Jesse Glick 2007-11-05 20:44:40 UTC
Fixing to always consider all files for compilation in case the previous build failed. I think this should address your
problem. I hope so, since if not I will not be able to fix it for 6.0.

Checking in java/j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEActionProvider.java;
/shared/data/ccvs/repository/java/j2seproject/src/org/netbeans/modules/java/j2seproject/J2SEActionProvider.java,v  <-- 
J2SEActionProvider.java
new revision: 1.68; previous revision: 1.67
done
Checking in java/j2seproject/test/unit/src/org/netbeans/modules/java/j2seproject/BuildImplTest.java;
/shared/data/ccvs/repository/java/j2seproject/test/unit/src/org/netbeans/modules/java/j2seproject/BuildImplTest.java,v 
<--  BuildImplTest.java
new revision: 1.21; previous revision: 1.20
done
Comment 11 Jesse Glick 2007-11-06 15:19:04 UTC
Verification of the fix would be much appreciated, by the way.
Comment 12 Marian Mirilovic 2007-11-06 16:08:38 UTC
Jirka, could you please verify this issue ? Thanks in advance.
Comment 13 mclaassen 2007-11-06 16:34:13 UTC
Looks like it is fixed to me using 200711060000...and I haven't noticed any deleterious effects.