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.
I have an acceptance testing project that uses Maven, Cucumber, Java, CDI and JUnit. (JAR packaging). Cucumber is executed by the maven-surefire-plugin via a unit test like the following: @CucumberOptions( plugin = { "json:target/cucumber.json", "html:target/cucumber-report.html" }, features = { "src/test/features" }, tags = { "~@wip" } ) @RunWith(Cucumber.class) public class RunCukesTest { } I believe that this is fairly standard. The Cucumber step definitions also need a beans.xml file for their CDI beans, and this is located in src/test/resources/META-INF/. The project has no src/main/ directory at all, and so I have configured maven-compiler-plugin with: <skipMain>true</skipMain> The skipMain setting is not strictly necessary; Maven "does the right thing" without it. This all worked fine in NetBeans 8.0 too. However, NetBeans 8.1 is repeatedly recreating the non-existent src/main/java/ directory! And this is a problem because as soon as src/main/java/ exists, NetBeans starts complaining that it can no longer find beans.xml either. I am guessing that this is because NetBeans starts searching for the beans.xml file in the wrong place. Everything would be fine if only either I could convince NetBeans that src/main/java/ does NOT need to exist for this project, or NetBeans could could locate its beans.xml file regardless of whether src/main/java/ exists or not. I have briefly considered pushing my test code into the src/main/ directory instead of src/test/, but that is not how maven-surefire-plugin expects to work either. I have also tried configuring my POM as follows: <build> <sourceDirectory>${project.basedir}/src/test/java</sourceDirectory> ... </build> But this confuses NetBeans even more!
could you please attach a sample project thanks
Created attachment 160550 [details] Sample Cucumber project This project is fine "out of the box". To reproduce the problem, try adding a new field of unknown type to the SampleStepsDefn class. This will cause NetBeans to create a src/main/java directory, which in turn will trigger warnings about "CDI artifact is found but there is no beans.xml file".
> To reproduce the problem, try adding a new field of unknown type to the SampleStepsDefn class. what exactly am i supposed to do - to create a new type like Reporter and then add it and clean/build? anything else? thanks
All you need to do is to open the project in NetBeans and then add a field to SampleStepsDefn such as private Method method; It doesn't have to be a Method field; any type that would require a new import statement would suffice. NetBeans should create the src/main/java directory as it tries to guess what the new import statement should be.
org.netbeans.modules.java.hints.errors.CreateElement.getPossibleSourceGroups() calls SourceGroupModifier.createSourceGroup() while merely trying to figure out to which SG a source belongs. this unfortunately forces maven to create the src/main/java directory in case it doesn't exist reassigning for further evaluation
Note that this issue is not present in NetBeans 8.0. I therefore consider this to be a regression.
*** Bug 256638 has been marked as a duplicate of this bug. ***
Fixed in jet-main#feccaef2859a, behaviour introduced by patch supplied in issue #250809 -- I didn't thought about the 'creation' side effect, sorry.