Confusion with Classpaths
I posted this as a bug, but I figured I would post it here as well in the hope that someone would have figured out a work-around to this problem. I'm quite vexed.
http://www.intellij.net/tracker/idea/viewSCR?publicId=7725
Thanks,
Mike
I would have preferred to develop a test case that I could repeat, but this problem is giving me enough of a headache, that I thought I would file it. We have a project set up with unit testing. Because of the nature of the legacy code, I use a parallel hierarchy with the same package name to build my test cases in. This way I have access to package protected methods and constants.
src/app/dataStorage is the name of the pacakge with the production code.
src/utest/app/dataStorage is the name of the unit tests.
My project path is src.
I have set up my classpath's to use compile to multiple output directories. I created an output path that looks like:
src/bin (I know..Kind of weird, but there are other reasons for this).
and then I defined the output directories for my two source path's.
src -> src
src/utest -> src/utest
What I really want to do is compile to sources, but I have never been able to get that to work.
Now. This works great for a while. But suddently, IDEA will start compiling the unit tests into the wrong output directory. Specifically, I find my .class files for my unit tests appearing in src/app/dataStorage. Of course, my classpath is set up to find utest first, and since it used to work, it picks up the old .class files, and the updates don't take hold.
To fix it, I quit IDEA, and then using our command line build process do a make clean ; make. I restart IDEA, and everything works great.
This is very irritating, and I am in the process of trying to deploy unit testing among my group. While I am sure I can live with it, I am almost certain that the lack of a stable platform from which to run unit tests will almost guarantee their demise.
Thanks,
Mike
Please sign in to leave a comment.
just wondering if symbolic links would help...
i mean a link at the level of src may actually do the trick - utest ->
src/utest
and then you'll probably need to exclude src/utest from the project.
"Michael Kirby" <kirby@ess.mc.xerox.com> wrote in message
news:107691.1038054099708.JavaMail.jrun@is.intellij.net...
hope that someone would have figured out a work-around to this problem. I'm
quite vexed.
>
>
>
>
this problem is giving me enough of a headache, that I thought I would file
it. We have a project set up with unit testing. Because of the nature of the
legacy code, I use a parallel hierarchy with the same package name to build
my test cases in. This way I have access to package protected methods and
constants.
>
>
>
>
directories. I created an output path that looks like:
>
>
>
>
>
to get that to work.
>
compiling the unit tests into the wrong output directory. Specifically, I
find my .class files for my unit tests appearing in src/app/dataStorage. Of
course, my classpath is set up to find utest first, and since it used to
work, it picks up the old .class files, and the updates don't take hold.
>
make clean ; make. I restart IDEA, and everything works great.
>
testing among my group. While I am sure I can live with it, I am almost
certain that the lack of a stable platform from which to run unit tests will
almost guarantee their demise.
>
I'm not sure I understand. Let me provide a bit more background.
Currently we use clearcase, and the vobs are structured like the following:
/vobs/proj/utest
/vobs/proj/pkg1
/vobs/proj/dir1/pkg2
So I end up with a classpath that looks like:
/vobs/proj/utest:/vobs/proj:/vobs/proj/dir1
If I could do it all over again, I would NEVER make the classpath point at our top-level directory. Nor would I encapsulate elements of the classpath within other elements of the classpath.
So given this, where exactly are you sugesting I put the link?
Tbanks,
Mike
Hi Michael,
Indeed strange things happen.
I tried to create the same project structure and compile and managed to
reproduce the bug. However all further attempts to reproduce the behaviour
failed: it simply works as expected. BTW, "Compile to sources" mode works ok
too.
Have you found any ways to reliably reproduce the bug?
--
Best regards,
Eugene Zhuravlev
JetBrains, Inc, http://www.intellij.com
"Develop with pleasure!"
"Michael Kirby" <kirby@ess.mc.xerox.com> wrote in message
news:107691.1038054099708.JavaMail.jrun@is.intellij.net...
hope that someone would have figured out a work-around to this problem. I'm
quite vexed.
>
>
>
>
this problem is giving me enough of a headache, that I thought I would file
it. We have a project set up with unit testing. Because of the nature of the
legacy code, I use a parallel hierarchy with the same package name to build
my test cases in. This way I have access to package protected methods and
constants.
>
>
>
>
directories. I created an output path that looks like:
>
>
>
>
>
to get that to work.
>
compiling the unit tests into the wrong output directory. Specifically, I
find my .class files for my unit tests appearing in src/app/dataStorage. Of
course, my classpath is set up to find utest first, and since it used to
work, it picks up the old .class files, and the updates don't take hold.
>
make clean ; make. I restart IDEA, and everything works great.
>
testing among my group. While I am sure I can live with it, I am almost
certain that the lack of a stable platform from which to run unit tests will
almost guarantee their demise.
>