NetBeans: Single file compilation doesn't work

P

palun

Sorry to bother you with this. I tried posting it to
c.l.j.softwaretools, but there seems to be very little happening there...

My problem:
I am trying to compile and run a single test-file in NetBeans 5. The
file is located in a separate test-tree (under src/test), and has
references to two other classes located in the main source tree
(src/main). (These, in turn, uses only java standard api classes.)

When I try "Compile file" (right mouse button menu, or F9) on the file,
the compiler insists on compiling not just my test file, but all files
in the project(!) - Why is this?

It seems single file compilation works fine for files in the main source
tree, but fails in the test tree. (Both trees have identical package
hierarchies. And both are recognized as containing source.)

Can someone please explain to me what is happening?

Thanks,
/ulf (who should have stuck with Eclipse)

PS. I couldn't find anything on the NetBeans fora (which btw are full of
questions without answers...)
 
O

Oliver Wong

palun said:
Sorry to bother you with this. I tried posting it to c.l.j.softwaretools,
but there seems to be very little happening there...

My problem:
I am trying to compile and run a single test-file in NetBeans 5. The file
is located in a separate test-tree (under src/test), and has references to
two other classes located in the main source tree (src/main). (These, in
turn, uses only java standard api classes.)

When I try "Compile file" (right mouse button menu, or F9) on the file,
the compiler insists on compiling not just my test file, but all files in
the project(!) - Why is this?

It seems single file compilation works fine for files in the main source
tree, but fails in the test tree. (Both trees have identical package
hierarchies. And both are recognized as containing source.)

Can someone please explain to me what is happening?

Thanks,
/ulf (who should have stuck with Eclipse)

PS. I couldn't find anything on the NetBeans fora (which btw are full of
questions without answers...)

By "test file", are you referring to JUnit tests?

Maybe NetBeans doesn't do progressive compilation the way Eclipse does.
I don't know, not familiar with NetBeans.

- Oliver
 
T

Thomas Kellerer

Sorry to bother you with this. I tried posting it to
c.l.j.softwaretools, but there seems to be very little happening there...

My problem:
I am trying to compile and run a single test-file in NetBeans 5. The
file is located in a separate test-tree (under src/test), and has
references to two other classes located in the main source tree
(src/main). (These, in turn, uses only java standard api classes.)

When I try "Compile file" (right mouse button menu, or F9) on the file,
the compiler insists on compiling not just my test file, but all files
in the project(!) - Why is this?
This is a known bug with the "Compile single" task. I think there is one
file in the NetBeans bug tracker.

As the whole thing is Ant-Based you can probably override the
compile-single task in the build.xml of your project to call the
necessary task to build all modified sources first.

Thomas
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top