NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Modifying Classpath for Tests in a Maven Project?

 
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users
View previous topic :: View next topic  
Author Message
peter149



Joined: 11 Aug 2011
Posts: 1

PostPosted: Thu Aug 11, 2011 7:06 am    Post subject: Modifying Classpath for Tests in a Maven Project? Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Java EE Users All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo