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.

Bug 225933 - Customizable order of sources/resources folders in Maven project
Summary: Customizable order of sources/resources folders in Maven project
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 8.2
Hardware: All All
: P3 normal with 3 votes (vote)
Assignee: Tomas Stupka
Depends on:
Reported: 2013-02-09 11:53 UTC by kalwi
Modified: 2016-08-17 12:55 UTC (History)
0 users

See Also:
Exception Reporter:

Sources organization in NetBeans vs. Eclipse (58.61 KB, image/png)
2016-07-07 13:19 UTC, kalwi

Note You need to log in before you can comment on or make changes to this bug.
Description kalwi 2013-02-09 11:53:41 UTC
I would appreciate a feature that would allow to define own order of top-level folders in Maven project, I mean source and test packages, resources, generated sources etc.

Current order is defined primarily by type of sources (sources, resources, generated sources) and inside of each group by relation to main or test tree. This logical structure can be visualized in this way:

|           |    main    | Source Packages
|  sources  +------------+
|           |    test    | Test Packages
|           |    main    | Other Sources
| resources +------------+
|           |    test    | Other Test Sources
|           | jaxb (main)| Generated Sources (jaxb)
| generated +------------+
|  sources  | ... (main) | Generated Sources (...)
|           |            |

But when I work, I work either with main sources/resources or with test sources/resources depending on whether I wrote either productive code or tests. So each time, folders from tree that I don't work with, disturb to my work. The worst case is that when I write a test (I'm in Test Packages) and I want to use a productive class, I don't know whether I will find it above my current folder (in Source Packages) or below (in Generated Sources) and it is confusing and not too ergonomic.

An order that will very ease my work would be defined primarily by main/test tree and then by type of sources:

|      |  sources  | Source Packages
|      +-----------+
| main | generated | Generated Sources (...)
|      |  sources  |
|      +-----------+
|      | resources | Other Sources
|      |  sources  | Test Packages
| test +-----------+
|      | resources | Other Test Sources

It could be done either by a simple switch like 'Organize folders by source type' / 'Organize folders by main/test tree', or by a possibility to define completely custom ordering which would be more general and would allow to define own customization to those who don't like neither current ordering or ordering proposed by me.

Thanks for your attention!
Comment 1 Milos Kleint 2013-02-27 15:03:05 UTC
Well, typically one doesn't browse generated files unless something is wrong with the generated content.
That's why it's way below the other stuff. With the same logic are the main+test sources the top items. As they are used most of the time. Resources less frequently, generated content almost never. We show then in the list because 
1. it makes Select in Projects work on generated content.
2. it shows the used what generated source roots the IDE knows about.. it's not shown -> you got a configuration problem.
Comment 2 kalwi 2013-02-27 20:54:01 UTC
It all depends on project type...

We use generated sources very extensively - generated domain objects, DB views, JAXB, XML transformation mappings etc. And besides that, not generated classes often extend those generated (or the other way around). So if I open generated class, I need to scroll over at least three blocks when I want to see e.g. not generated inherited class.

Maybe other even more uncomfortable scenario is working with application context XML resources - we use proprietary Spring-based component framework with component definitions in Spring context XMLs (but other EE technologies probably have a similar approach). So accessing main sources together with resources is intensive. Then, writting tests also includes intensive work with both test sources and resources together - test resources in my case contain at the first test data used in tests (business objects in JSON form, DbUnit datasets...) and at the second - again Spring contexts for tests. I could say that accessing test resources (because of changes of bean names etc.) is more frequent than fixing test sources itself.

So I agree with you that current structure is good for a typicall project, but for some other kinds of projects can be unsuitable and proposed customization makes a sense. Of course a switch between both approaches should be available.
Comment 3 Martin Balin 2016-07-07 08:37:57 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss
Comment 4 kalwi 2016-07-07 13:19:31 UTC
Created attachment 160301 [details]
Sources organization in NetBeans vs. Eclipse

Well, this is not a bug, but a feature request, so I'm reopening it.

I've created a screenshot with small comparison how folders are organized in Eclipse. I'd like to have a possibility to define my own order of folders by the content type, or at least to have a switch into a mode where all main sources/resources would precede test sources/resources (like in Eclipse).

As you can see on the screenshot, I have a lot of generated sources and all main sources/resources folders are organized in three groups, alternating the test sources/resources. I usually work with either main, or with test sources/resources, but not so often with both together.

If this feature request was rejected again, I would at least enjoy some hints how to write a plugin which would allow it. I've found the place in the NB source code where folders are put together into the tree, but I'm not so skilled in NB plugins development so I don't know what exactly I have to implement. The effort was worth for me, because the current organization of folders really disturbs me every day. Anyway, I would consider to implement this FR directly in NB since there are also some other voters for this issue.