Honza-cz opened a new issue, #5775:
URL: https://github.com/apache/netbeans/issues/5775

   ### Apache NetBeans version
   
   Apache NetBeans 17
   
   ### What happened
   
   We use maven for our applications. We use multiple folders with JUnit tests 
(sample below). The extra test folder is added to maven by 
"build-helper-maven-plugin". In netbeans, the folder appears in project window 
as "Generated Test Sources (java)". The problem is, if I expand that folder and 
I try to create a new Java Class (right click on package - Java Class), a new 
file will be created in main folder and default package. 
   
   So the problem is not how this extra folder is represented in project 
window, but it is not possible to create a new source file in that extra 
folder. It is created in main (not even test folder) and then I have to move it 
to desired folder manually.
   
   before creating a new file in "extra-test"
   
   ├── extra-test
   │   └── java
   │       └── com
   │           └── mycompany
   │               └── extra
   │                   └── HelloTest.java
   ├── main
   │   └── java
   │       └── com
   │           └── mycompany
   │               └── extra
   │                   └── Main.java
   └── test
       └── java
           └── com
               └── mycompany
                   └── extra
                       └── NormalTest.java
   
   
   after creating **NewClass.java** file in "extra-test"
   ├── extra-test
   │   └── java
   │       └── com
   │           └── mycompany
   │               └── extra
   │                   └── HelloTest.java
   ├── main
   │   └── java
   │       ├── com
   │       │   └── mycompany
   │       │       └── extra
   │       │           └── Main.java
   │       └── NewClass.java
   └── test
       └── java
           └── com
               └── mycompany
                   └── extra
                       └── NormalTest.java
   
   ### How to reproduce
   
   either you can use attached sample project or...
   
   - Create a new maven java project
   - Create a new folder "src/extra-test/java"
   - Add a new source to maven:
   
   > 
   
       <build>
           <plugins>
               <plugin>
                   <groupId>org.apache.maven.plugins</groupId>
                   <artifactId>maven-surefire-plugin</artifactId>
                   <version>3.0.0</version>
               </plugin>
               <plugin>
                   <groupId>org.codehaus.mojo</groupId>
                   <artifactId>build-helper-maven-plugin</artifactId>
                   <version>3.3.0</version>
                   <executions>
                       <execution>
                           <id>add-extra-test-source</id>
                           <phase>generate-test-sources</phase>
                           <goals>
                               <goal>add-test-source</goal>
                           </goals>
                           <configuration>
                               <sources>
                                   <source>src/extra-test/java</source>
                               </sources>
                           </configuration>
                       </execution>
                   </executions>
               </plugin>
           </plugins>
       </build>
   
   
   - in project window
   -- expand Generated Test Sources (java)
   -- click by right button on default package (or any package)
   -- select New Java Class
   - a new file is created in **src/main/java and** not in 
**src/extra-test/java**
   
   Similar behavior observerd, when a new file is created from File window as 
well, not only by Project window).
   
   I can try to fix the issue, but not sure where exactly. "Generated Test 
Sources (java)" is linked to this source file: 
_netbeans/java/maven/src/org/netbeans/modules/maven/classpath/MavenSourcesImpl.java_
   
   ### Did this work correctly in an earlier version?
   
   No / Don't know
   
   ### Operating System
   
   Ubuntu/Windows10
   
   ### JDK
   
   JDK19
   
   ### Apache NetBeans packaging
   
   Apache NetBeans binary zip, Own source build
   
   ### Anything else
   
   The problem is systematic, not random
   sample project:
   
[extra-test-folder.zip](https://github.com/apache/netbeans/files/11153704/extra-test-folder.zip)
   
   screenshots:
   
![image](https://user-images.githubusercontent.com/60773743/229937550-577b3697-eafb-4b5a-baf7-8ad9fa0faa0d.png)
   
   =>
   
   
![image](https://user-images.githubusercontent.com/60773743/229937662-37a093a4-8842-4095-9178-1a82a92ac50b.png)
   
   
   ### Are you willing to submit a pull request?
   
   Yes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to