This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
It is not needed.
So this includes initial project creation, which now by default contains beans.xml, right?
What "CDI 1.1 case" means? In Maven we are creating beans.xml by default only when the Java EE 7 archetype is used.
I'm not sure if I understand that correctly but it seems to me that the beans.xml can be still useful in case that developers doesn't use any scope defining annotation which could be common up to now. If we wouldn't create beans.xml, we should probably create new CDI hint that the @Named beans without scope definition will not be usable as CDI beans (will not be in bean archive) in case of missing beans.xml file. And also probably create issue for Named bean wizard creation which should offer scope definitions and probably validation for chosen scope in case of missing beans.xml too. Please David correct me if I'm wrong, thanks a lot.
(In reply to comment #2) > What "CDI 1.1 case" means? In Maven we are creating beans.xml by default only > when the Java EE 7 archetype is used. Yes, EE7 == CDI 1.1. (In reply to comment #3) > I'm not sure if I understand that correctly but it seems to me that the > beans.xml can be still useful in case that developers doesn't use any scope > defining annotation which could be common up to now. Note MartinF that beans.xml generated for version 1.1 has by default bean-discovery-mode="annotated" which makes bean archive behave as implicit one - that is only beans with 'defining annotations' are provided. That means that having beans.xml or not will have the same effect. > If we wouldn't create beans.xml, we should probably create new CDI hint that > the @Named beans without scope definition will not be usable as CDI beans (will > not be in bean archive) in case of missing beans.xml file. This hint should be created in any case even for archives with beans.xml with bean-discovery-mode="annotated". > And also probably create issue for Named bean wizard creation which should > offer scope definitions and probably validation for chosen scope in case of > missing beans.xml too. Either that or wizard could automatically add @Dependent annotation - scope will be inherited.
> Note MartinF that beans.xml generated for version 1.1 has by default > bean-discovery-mode="annotated" which makes bean archive behave as implicit one > - that is only beans with 'defining annotations' are provided. That means that > having beans.xml or not will have the same effect. I know, sorry I was improving my CDI knowledges during whole day. ;) In any case, I agree that the file is not necessary any more in ee7 projects. I wanted to say that together with this issue CDI should come up with some fixes/enhancements to provide better CDI1.1 support related especially to 'implicit bean archives' change.
Let's try to fix this for Beta.
http://hg.netbeans.org/web-main/rev/1d160860c2ba for ant
Re. #1d160860c2ba - feel free to rename "isCDIEnabled" Sergey. It could even be named "isGenerateBeansXML" and "setGenerateBeansXML".
Integrated into 'main-golden', will be available in build *201306252301* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/1d160860c2ba User: Sergey B. Petrov <sj-nb@netbeans.org> Log: #230015 do not ctreate in ant/ee7
for maven, from command line: mvn -DarchetypeGroupId=org.codehaus.mojo.archetypes -DarchetypeArtifactId=webapp-javaee7 -DarchetypeVersion=1.0 -DarchetypeRepository=https://nexus.codehaus.org/content/repositories/snapshots/ -DgroupId=org.glassfish -DartifactId=javaee7-sample -Dversion=1.0 -Dpackage=org.glassfish.javaee7-sample -Darchetype.interactive=false --batch-mode --update-snapshots archetype:generate create an application with beans.xml David, is it an issue in maven ee7 archetype or somewhere else? If yes, where to file this issue?
and ejb-javaee7:1.0 need to be reviewed too.
(In reply to comment #10) > is it an issue in maven ee7 archetype or somewhere else? Yes, it is. The original decision was to create beans.xml by default. I have to update archetype and create newer version to get it fixed. > If yes, where to file this issue? This is my job, I guess.. I'll take care of it
(In reply to comment #12) > > This is my job, I guess.. I'll take care of it can it be done for 7.4 beta. it may have sense to separate maven from ant otherwise and transplant ant fixes at least.
No need to transplant Ant fixes for beta - the beta branch was thrown away and will be branched again from trunk. So what is now in trunk will be a part of beta.
Created attachment 136715 [details] confusing application I have an application and it fail to work without beans.xml and works fine with beans.xml with bean-discovery-mode="annotated", from previous discussion I see it as wrong behavior and the application should work the same in both use-cases, any ideas? I'm still evaluating cdi technology and may miss something.
The application you attached does not work even if beans.xml is present and bean-discovery-mode="annotated". But changing it to bean-discovery-mode="all" makes it deployable and works OK. The problem is that injection point in ItemProcessor cannot find bean to inject because DefaultItemDao does not have any scope defining annotations. Annotate DefaultItemDao with @Dependent and everything will work even without beans.xml.
ok, I need to reverify what is the difference in gf installations/nb 7.3.1 vs 7.4, I was able to deploy at the office but can't deploy at home. Also if I create at home beans.xml it is created with 1.0 version in 7.3.1. At the office the only requirement to fix the application was to add beans.xml with 1.1 version with annotated option.
sorry for mixing up, my gf installation was about 1 month before gf4 release.
Sergey, just to be sure. Only thing I need to do is to not generate beans.xml at all, right?
yes
Fixed for Maven in: web-main #cc494350006c Thanks for quick response Sergey! Closing the issue.
Integrated into 'main-silver', will be available in build *201307182300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/cc494350006c User: Martin Janicek <mjanicek@netbeans.org> Log: Using updated Java EE 7 archetypes in version 1.1 - fixing issues: #230015, #231878 and #231479
*** Bug 234105 has been marked as a duplicate of this bug. ***