Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 227976 - JUnit: cannot import classes from source package
JUnit: cannot import classes from source package
Status: RESOLVED WORKSFORME
Product: java
Classification: Unclassified
Component: Project
7.3
PC Windows 7 x64
: P3 (vote)
: 7.3
Assigned To: Tomas Zezula
issues@java
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-03-27 03:31 UTC by ceklock
Modified: 2013-03-28 09:00 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo