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 256094 - Problem with loading a project which has 2 different project files.
Summary: Problem with loading a project which has 2 different project files.
Status: CLOSED INVALID
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Infrastructure (show other bugs)
Version: 8.1
Hardware: PC Other
: P2 normal with 2 votes (vote)
Assignee: Tomas Stupka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-10-22 08:59 UTC by Christian Lenz
Modified: 2018-12-18 14:35 UTC (History)
3 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Lenz 2015-10-22 08:59:15 UTC
I have a really big problem, I have a project with a package.jsomn which should be a html5 project and there is a pom.xml file for a nexus repository which is needed a real world case. The problem is, when I clone the project, netbeans will always start the project as a maven project, but this is a HTML5 Angular project, only the pom.xml file is inside and needed for an internal infrastructure and there is a tests folder for the QA with a pom file inside.

It is not possible to switch the project type of the project or to get a hint, which project type do you want to open this project? I created a ticket for this before: https://netbeans.org/bugzilla/show_bug.cgi?id=246939

The other problem, when I try to create a new "HTML5/JS project with existing sources" I can't create it with the name of the folder/project, because netbeans says: "Site root is already netbeans project (maybe only in memory).

Is there a quick workaround for this? I can't use the project anymore as I expected.


Regards

Chris
Comment 1 Christian Lenz 2015-10-22 09:01:03 UTC
I tested it with a new little folder: "Neuer Ordner" with 2 files in it, pom.xml and package.json. It will always open it as a maven project and when I try to create a new HTML5/JS project with existing sources and the site root isC:\Path\Neuer Ordner. It says that this is already a project maybe in memory.
Comment 2 Tomas Stupka 2015-10-26 16:48:16 UTC
hi,

did you try to migrate the project to maven? 
it should be able to do everything as the html5 project
Comment 3 Christian Lenz 2015-10-27 08:14:52 UTC
I don't migrate it and I don't want to, I only open the project as a maven project, which netbeans mentioned me, but it is really a HTML5 Project, not maven. The first problem is, that I can't see my source/site files, the modules node is empty in the project window, I don't want to switch to the file window. The path goes to C:\Projects\project\src\main\java but this is not the correct path for my project files.

The other part is, that the a HTML5 project has a node called "important files". It has the gruntfile, gulpfile, bower.json and package.json inside of it. Than there is a node for Karma tests. Both things are missing. 

I can't set any testrunner inside the properties of a maven/javascript project, I can't set selenium for this project, I don't have an option for cordova and I can't map gulp or grunt tasks. So in my perspective, there is a lot of missing, when I have to use the maven project instead of a HTML5/JavaScript project. I don't know how to migrate to get the exact options and nodes as for the HTML5/JavaScipt project. What I expect is an option at the open project wizard, to choose the right project type, if netbeans recognize more than one project type OR an option two switch an opened project type back to another one.

Regards
Comment 4 Christian Lenz 2015-12-03 12:02:00 UTC
Anything new here? I can't use netbeans for this case.
Comment 5 Christian Lenz 2016-01-11 08:40:31 UTC
Push, this is really urgent and a case which happens. Is there a quick workaround for this that I can work until it will fixed?
Comment 6 Tomas Stupka 2016-01-14 16:03:49 UTC
the problem is that the netbeans project infrastructure does not allow to work with more than one project type for one project (folder). That also applies to switching between different projects. I'm not aware about any simple solution to this.
Comment 7 Christian Lenz 2016-01-14 22:01:31 UTC
This is ok, because I want to use only one project type, the problem is I can't use this type which I wanted and this is the Client-Side project, becaseu it s a client-side project. But the features, what I mentioned, are missing in the maven project type, which this project type is.

As I know, the project type is hard coded inside the project.xml file:

This is from an other REAL HTML5/Client-Side project

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
    <type>org.netbeans.modules.web.clientproject</type>
    <configuration>
        <data xmlns="http://www.netbeans.org/ns/clientside-project/1">
            <name>pulsweb</name>
        </data>
    </configuration>
</project>

So Tomorrow I will have a look, whether netbeans had created maybe a maven project and I will change this to clientside-project. Hope that helps me as ONLY been a workaround.

I have a solution for this, which I created here as a ticket: https://netbeans.org/bugzilla/show_bug.cgi?id=246939

So when I have this case, what I actually have, to open a project with 2 different project files inside, I HAVE to choose the right project for this first AND I should have the option to change the project to another type, which is only supported in this project. So in this case, I need a project type switcher where I can switch from maven to HTML5. And maybe back if I need to run stuff, but the pom file is only needed for our company structure. How does this sounds?


Regards

Chris
Comment 8 Christian Lenz 2016-01-17 16:00:53 UTC
Ok I can't change the project inside the project.xml because there is no nbproject folder...
Comment 9 Christian Lenz 2016-06-28 09:04:29 UTC
Now this happens with the nightly build too and with a more pain in the ass. Because in NB 8.1 I have a multi module maven project which have maven modules with pom files inside. I have a client module for the frontend which is written with GWT. In this module there is a pom file and a package json file, beacuse we use some grunt tasks (sass prefixer) to call them via maven. In NB 8.1 everything is ok. When I open the nightly build of NB I got the message that the project was automatically configured and now you can guess for which project type... It is now a HTML5 Project type because of the package.json which one. This is a huge problem for me.
Comment 10 Christian Lenz 2016-06-28 09:06:29 UTC
I really hope that this will be fixed soon with an option that I can see which project types NB detects and that I can switch back to an other project configuration.
Comment 11 Tomas Stupka 2016-08-03 15:06:00 UTC
like already mentioned - there is no simple solution. This isn't just about simply opening a project as one type or another. 
Things can get much trickier: it is possible to open many projects at once; the IDE often loads not opened projects on the background (e.g. when a file is accessed from favorites) and such project might be later manually opened by the user with a different type in mind; projects depend on each other - a dependent on mvn project suddenly changes to html5 and features in other projects which dependent on it suddenly start to behave differently, stop working or are in the middle of a task which still relies on the other project being available as a mvn project ... 

not saying that the issue doesn't make sense, but this is a requested to change a feature which works well and as designed for 10+ years -> enhancement.
Comment 12 Christian Lenz 2016-08-04 11:18:04 UTC
I understand what you mean but sry it doesn't work well. I can't create a HTML5 project with existing sources from a project, which netbeans recognizes as a mvn project because of a pom.xml file. But no this is not a maven project, it has a package.json file too. The problem why we need is a pom.xml is our nexus repo. I can't change any of the project I only use it and it is used in netbeans as a maven project, which is wrong. I wanted to create a nbproject folder with new html5 project with existing sources but netbeans says: Site root is already NetBeans project (maybe only in memory).

Of course you have to add such project switcher in each context, open a project, open more than one projects (where you can check the project types per project and change it, etc.) etc.
Comment 13 Tomas Zezula 2016-08-04 11:21:52 UTC
If we limit the problem to case that the folder with pom.xml cannot be opened as HTML5 project there is an easy possible workaround. We can add a property telling the IDE which project types should be ignored for given folder. This workaround is quite easy to do.
Comment 14 _ wadechandler 2017-02-10 14:12:24 UTC
We really need NB to be able to enable features at will, and a good in between would be to allow the user to switch between project types. Currently, the infra picks the first one that says it is what it is. The system could enumerate all of them. Then essentially an action could take a known project provider, and use it versus asking the system to load one.

Some future state, it would be nice if some how multiple project feature types could be merged together. For instance, there are definitely times that I want to work on the UI and the backend together, and the UI may be Angular with a NodeJS build, and the backend is spring boot. Too, there are node Gradle plugins to front NodeJS builds etc, but I still need to perform actions related to JS projects on those files. If I could easily use both feature sets, it would make the work flow. The reality is one can easily do this with VI or emacs as they are text editors, and the only reason this is difficult in NB is the models, and definitely will be hard to change. But things one can not do easily in vi or emacs are the things IDEs are good at :-). Anyways, that would be some better future state which would obviously take way more work than switching project types on the fly.
Comment 15 Christian Lenz 2017-05-23 12:18:59 UTC
Will there a solution in NB9? It prevents me using NetBeans for some projects which is really pain in the ass...
Comment 16 Christian Lenz 2017-05-23 12:23:15 UTC
@tomas what happens if I have a pom.xml file and a package.json in 2 different projects and one project should be treated as a pom (maven) based project and the other one as a html 5 project?

So in real world cases, you have a maven based project with a pom.xml and you add later HTML5 stuff to it so like a package.json. First you should decide that the project should stay as it was before and vice versa. You have to need a switch to choose how to treat a project for this type that you want.
Comment 17 Christian Lenz 2018-12-18 14:34:59 UTC
I will close it, because it will handled now at the JIRA board: https://issues.apache.org/jira/browse/NETBEANS-1802. Please discuss it there for further information.