Saturday, July 30, 2011

Re: Tested class changes not visible to test class using gwt-maven-plugin

I haven't tested it myself, but this seems to deal with how to create relative paths. Another solution may be to edit the .classpath manually.

If I don't move the external folder at the bottom, then I won't be able to properly use Eclipse F3 / Go to definition functions - they will bring me to the class file, not to the source, which renders navigation a bit cumbersome.
There may be something around this too; it hasn't bothered me much (I'm on a single-person project at the moment and can easily live with this), but if you find something I'd be glad to know :)

Cheers,
-- 
Sébastien Tromp

2011/7/29 cri <chuck.irvine.ks@gmail.com>
I like your workaround a little better than mine. It does result in a
non project relative directory path in my .classpath file. We
check .classpath files into svn and the non relative directory
wouldn't match the directory setup of other users. I'm thinking that
there may be a way to make this relative. Do you know how?

I suppose that I'll find out soon enough, but that problems occur if
you don't move the external classpath to the bottom of order and
export?

Thanks a lot Sebastien!

Chuck


On Jul 29, 12:14 pm, Sébastien Tromp <sebastien.tr...@gmail.com>
wrote:
> I have the same issue, and am using a similar workaround. The only
> difference is that I add the external class folder to my Java build path.
> When I run JUnit tests, I make sure the class folder is at the top of the
> Order and Export list, and when in standard development I put it at the
> bottom.
>
> This way it works for all test cases - but still not a great workaround.
> --
> Sébastien Tromp
>
> 2011/7/29 cri <chuck.irvine...@gmail.com>
>
>
>
>
>
>
>
> > Can anyone help with this? (I know there is a separate mailing list
> > for gwt-maven-plugin but I'm not sure it has a lot of subscribers.)
>
> > Given that you have a JUnit test case class in /src/test/java/*/
> > FooTest.java and a tested class /src/main/java/*/Foo.java. If you
> > attempt run your test case in FooTest.java you will get a runtime
> > error indicating that FooTest doesn't have access to the modified
> > Foo.class file.
>
> > Steps to reproduce.
> > 1) Generate a GWT project using the gwt-maven-plugin archetype.
> > 2) Import the project into Eclipse using new->Existing Projects into
> > Workspace.
> > 3) Create class Foo.java in /src/main/java/**/client.
> > 4) Define a simple test method in Foo.java "public hello(){return
> > "hello"}"
> > 5) Create class FooTest.java in /src/test/java/**/client.
> > 6) Define a test in FooTest.java:
> > "@Test public void testFooTest() {Foo foo = new Foo();
> > assertEquals("hello", foo.hello());}
> > 7) Run the test case method. You will get a runtime message
> > complaining that Foo can't be found.
>
> > A workaround is to:
> > 1) open the junit run configuration.
> > 2) select the classpath tab.
> > 3) select user entries
> > 4) click advanced button
> > 5) select "Add folders" radio button
> > 6) click ok button
> > 7) add folder src/main/webapp/WEB-INF/classes
>
> > Its not a great workaround since you have to do this with every test
> > case run configuration.
>
> > Another workaround is to run Project/clean on the project.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.
> > To post to this group, send email to google-web-toolkit@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-web-toolkit+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.


--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment