jumperchen / run-jetty-run

Automatically exported from code.google.com/p/run-jetty-run
0 stars 0 forks source link

Running the plugin on a maven project should not include the test classes #42

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Create a maven (webapp) project
2. Start the Jetty plugin to test your webapp
3. Notice that the classloader also loads the classes under:
target\test-classes

What is the expected output? What do you see instead?

I'd expect NOT to load my test classes when running the webapp. Doing so
creates conflicts as i have the same class defined twice in my project.
Once for testing and once for deploy. (Both classes doing something different)

A simple patch would be to change ProjectClassLoader.java:

        String entry = projectClassPath.substring(start, index);
        if (!entry.endsWith("test-classes")) {
            System.err.println("ProjectClassLoader: entry="+entry);
            super.addClassPath(entry);
        }

thx

Original issue reported on code.google.com by atv...@xs4all.nl on 1 Feb 2010 at 2:43

GoogleCodeExporter commented 9 years ago
I'm getting the same thing.  Autowiring is causing me pain.

Original comment by john.she...@gmail.com on 26 Oct 2010 at 11:58

GoogleCodeExporter commented 9 years ago
It's hard to determine yes or no in this case,
I perfer to make it configurable.

I will add this option in 1.2.1 

Original comment by tonylovejava on 11 Mar 2011 at 3:26

GoogleCodeExporter commented 9 years ago

Original comment by tonylovejava on 12 Mar 2011 at 7:51

GoogleCodeExporter commented 9 years ago
Ready since 2011/03/14 ,
committed for r79 (logic) , r83 (add option to view), r84 (fix logic in view).

Original comment by tonylovejava on 14 Mar 2011 at 9:16

GoogleCodeExporter commented 9 years ago
In other approach, you could config project classpath to remove test source 
folder directly.

Original comment by tonylovejava on 14 Mar 2011 at 9:17

GoogleCodeExporter commented 9 years ago
This RJR option is only filting that class output endwith "test-classes".

Original comment by tonylovejava on 14 Mar 2011 at 9:18

GoogleCodeExporter commented 9 years ago
Fix a typo in r90 .

Original comment by tonylovejava on 18 Mar 2011 at 6:58