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 227976

Summary: JUnit: cannot import classes from source package
Product: java Reporter: ceklock
Component: ProjectAssignee: Tomas Zezula <tzezula>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P3    
Version: 7.3   
Hardware: PC   
OS: Windows 7 x64   
Issue Type: DEFECT Exception Reporter:

Description ceklock 2013-03-27 03:31:51 UTC
I am creating JUnit 4.10 tests and having trouble to import classes from source package. When I use classes from source package in my JUnit tests the editor does not show any error, but when I try to compile the tests the compiler shows errors like this:

error: cannot find symbol
import meuspila.MeusPilaConstants;
  symbol:   class MeusPilaConstants
  location: package meuspila
Comment 1 ceklock 2013-03-27 03:40:24 UTC
Oh, there is another problem as packages of the build dir are always empty when I do clean and build... 

init:
deps-jar:
Created dir: C:\Users\Carlos\Desktop\projetos_java\meuspila3\build
Updating property file: C:\Users\Carlos\Desktop\projetos_java\meuspila3\build\built-jar.properties
Created dir: C:\Users\Carlos\Desktop\projetos_java\meuspila3\build\classes
Created dir: C:\Users\Carlos\Desktop\projetos_java\meuspila3\build\empty
Created dir: C:\Users\Carlos\Desktop\projetos_java\meuspila3\build\generated-sources\ap-source-output
Compiling 49 source files to C:\Users\Carlos\Desktop\projetos_java\meuspila3\build\classes
Copying 5 files to C:\Users\Carlos\Desktop\projetos_java\meuspila3\build\classes
Copied 16 empty directories to 14 empty directories under C:\Users\Carlos\Desktop\projetos_java\meuspila3\build\classes
compile:
Created dir: C:\Users\Carlos\Desktop\projetos_java\meuspila3\dist
Copying 1 file to C:\Users\Carlos\Desktop\projetos_java\meuspila3\build
Copy libraries to C:\Users\Carlos\Desktop\projetos_java\meuspila3\dist\lib.
Building jar: C:\Users\Carlos\Desktop\projetos_java\meuspila3\dist\meuspila3.jar
To run this application from the command line without Ant, try:
java -jar "C:\Users\Carlos\Desktop\projetos_java\meuspila3\dist\meuspila3.jar"
jar:
CONSTRUÍDO COM SUCESSO (tempo total: 1 segundo)
Comment 2 ceklock 2013-03-28 07:31:33 UTC
Actually I think this is not directly related to JUnit... It happened because something made the compiler not generate the build files. 

Maybe I open a new bug if I can reproduce it again.
Comment 3 Tomas Zezula 2013-03-28 09:00:43 UTC
Works fine for me.
>C:\Users\Carlos\Desktop\projetos_java\meuspila3\build\generated-sources\ap-source-output
>Compiling 49 source files to
>C:\Users\Carlos\Desktop\projetos_java\meuspila3\build\classes
According to this log the classes were compiled into build\classes.
If it's J2SE Application project, the Compile On Save is disabled otherwise there is no need to do compilation.
Can you attach ant verbose log.