I can confirm that moving beans.xml from src/main/webapp/WEB-INF to src/main/resources/META-INF was the easy solution for me and it still works when running the app inside wildfly 8 which is weld based.
Thanks for the input. Best regards Jens On Wed, Mar 16, 2016 at 10:17 AM, Martin Kouba <[email protected]> wrote: > I see. Yes, for EE6/Weld 1.1 this might be an issue. > > Thanks, > > Martin > > Dne 16.3.2016 v 10:03 Gerhard Petracek napsal(a): > > hi martin, >> >> i would need to re-run the tests we did back then. >> while testing codi with all major ee6 servers some years ago, we saw such >> issues >> (in several cases only one of both locations worked). >> >> regards, >> gerhard >> >> >> >> 2016-03-16 8:42 GMT+01:00 Martin Kouba <[email protected]>: >> >> Dne 15.3.2016 v 19:29 Gerhard Petracek napsal(a): >>> >>> hi jens, >>>> >>>> yes - ds-test-control is java-se based (including the possibility to use >>>> e.g. mocked containers like myfaces-test). >>>> however, to avoid duplication you can move WEB-INF/beans.xml to >>>> META-INF/beans.xml (-> WEB-INF/classes/META-INF/beans.xml). >>>> in case of weld-based servers which have issues with that, you can use a >>>> >>>> >>> I'm not aware of any problems Weld has with >>> "WEB-INF/classes/META-INF/beans.xml". Could you be more specific? E.g. >>> what >>> version of Weld and environments do you have in mind? Thanks. >>> >>> >>> corresponding build-config (with maven e.g. build/resources/...). >>> >>>> >>>> regards, >>>> gerhard >>>> >>>> >>>> >>>> 2016-03-15 16:44 GMT+01:00 Jens Teglhus Møller <[email protected]>: >>>> >>>> Hi >>>> >>>>> >>>>> I'm trying to get my environment setup correctly but keep running into >>>>> having duplicated beans.xml >>>>> >>>>> I have junit tests that uses CdiTestRunner and for them to work I'm >>>>> forced >>>>> to have a beans.xml in src/main/resources/META-INF (it took me a while >>>>> to >>>>> figure out that I needed it there if I wanted to inject them in my unit >>>>> test classes). I'm not doing any mocking. >>>>> >>>>> But since it is a webapp, the correct location is in WEB-INF/ so I >>>>> need a >>>>> copy there as well. >>>>> >>>>> The documentation for the Test-Control module states that I should put >>>>> my >>>>> beans.xml in src/test/resources/META-INF/beans.xml but if I do that I >>>>> cannot inject my beans from src/main (I tried setting >>>>> org.jboss.weld.se.archive.isolation >>>>> to false but that did not help) >>>>> >>>>> Question is: Am I forced to have beans.xml in >>>>> src/main/resources/META-INF >>>>> if I want to run unit tests or am I doing something wrong? >>>>> >>>>> I'm running ds v1.5.4 and weld-se-core v2.3.3-Final. >>>>> >>>>> I have been googling for a while and did not find anything, any >>>>> pointers >>>>> are welcome. >>>>> >>>>> Best regards Jens >>>>> >>>>> >>>>> >>>> -- >>> Martin Kouba >>> Software Engineer >>> Red Hat, Czech Republic >>> >>> >> > -- > Martin Kouba > Software Engineer > Red Hat, Czech Republic >
