NetBeans Forums
| View previous topic :: View next topic |
| Author |
Message |
peter149
Joined: 11 Aug 2011 Posts: 1
|
Posted: Thu Aug 11, 2011 7:06 am Post subject: Modifying Classpath for Tests in a Maven Project? |
|
|
I've the following situation and problem when working with maven projects:
There is one module that contains some business logic and makes use of spring security. There are two other modules (i.e. maven projects), that expose some operations of the business logic via SOAP-WS and REST-WS respectively.
Both WS-modules contain unit-tests that bring up a grizzly web server and make calls to the web services.
When running these tests as part of the maven build cycle (e.g. "clean and build" from the project's context menu) everything is fine. However, when running the test from the file context menu ("Test File" or "Debug Test File") the tests fail with an error message saying that the spring application context could not be loaded due to a duplicate definition of <global-method-security> (Spring allows only one occurrence of this element in all configuration files). There is only one occurrence but debugging inside the spring bean loader classes revealed that one an the same config-file is loaded twice.
Apparently netbeans adds "src/main/resources" as well as "src/main/target/classes" to the classpath, which causes spring to find the config-file in either location.
The question is whether there is a way (e.g. by editing a build.xml file?) to cause netbeans to add only one of these locations to the test's classpath?
AND: This error only occurs when the project containing the <global-method-security> is a dependency (i.e. in my WS-projects). In my business logic project everything run's just fine! |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|