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 250267 - New project cannot be created if project dir contains composer.json
Summary: New project cannot be created if project dir contains composer.json
Status: RESOLVED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Project (show other bugs)
Version: 8.1
Hardware: All All
: P3 normal with 1 vote (vote)
Assignee: Tomas Mysik
URL:
Keywords:
Depends on: 250232 253521
Blocks: 253339
  Show dependency tree
 
Reported: 2015-02-06 12:35 UTC by Tomas Mysik
Modified: 2015-07-18 01:46 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
proposed fix (6.19 KB, patch)
2015-07-16 06:13 UTC, Tomas Mysik
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomas Mysik 2015-02-06 12:35:40 UTC
If one wants to use the New Project wizard with existing sources but his project contains composer.json file, it is not possible because of PHP ProjectConvertor for composer.json file. Once issue #250232 is fixed, we should be bale to allow this.

Thanks.
Comment 1 waldermort 2015-03-05 16:29:48 UTC
Please up the priority on this.

I cannot use "create new project" because of the mentioned composer.json file. If I try opening the project, it opens but:

1. I cannot change the project name. 
2. The source directory is /star/src when it should be /star. 
3. I cannot change the source directory.

Temporarily renaming composer.json allows me to create a new project from sources. This should be a P1 fix.
Comment 2 Tomas Mysik 2015-03-06 06:06:23 UTC
(In reply to waldermort from comment #1)
> Please up the priority on this.

No need, we depend on P2 issue.

> 1. I cannot change the project name. 

Right click on your project and Rename... does not work for you?

> 2. The source directory is /star/src when it should be /star.
> 3. I cannot change the source directory.

Well, you can change it manually in nbproject/project.properties but I will file a new issue for it to be able to change it in Project Properties dialog.

Thanks.
Comment 3 Tomas Mysik 2015-03-06 06:09:36 UTC
(In reply to Tomas Mysik from comment #2)
> Well, you can change it manually in nbproject/project.properties but I will
> file a new issue for it to be able to change it in Project Properties dialog.

Issue #250952.
Comment 4 waldermort 2015-03-06 09:11:48 UTC
The right click rename does work but wouldn't it be better to be able to change it from the "Open project" dialogue?

Surely editing nbproject/project.properties is a workaround. I just tested it with a vendor directory in a Symfony project. The source directory is correct. This problem appears when opening a new Symfony main project. The source directory is wrongly determined to be /project/src when it should be /project.

The "create dialogue" can no longer be used. netbeans complains with a message "Source folder is already a netbeans project. Maybe in memory only.".

When creating a project from an unreliable source such as composer.json, all project properties should be overridable from the open/create dialogue. I suggest notifying the user with a message when 'opening' a project based on composer.json. But more importantly, change the "create dialogue" to auto fill the parameters and also notify the user that they have been guessed from composer.json.

I wasted 4 hours of work yesterday trying to open an existing project after it had become corrupted. If the IDE had given me any indication that it was reading the composer.json I could have resolved it in two minutes.
Comment 5 Tomas Mysik 2015-03-06 10:40:39 UTC
(In reply to waldermort from comment #4)
> The right click rename does work but wouldn't it be better to be able to
> change it from the "Open project" dialogue?

No, in the Open Project dialog you are opening project, not renaming it.

> Surely editing nbproject/project.properties is a workaround. I just tested
> it with a vendor directory in a Symfony project. The source directory is
> correct. This problem appears when opening a new Symfony main project. The
> source directory is wrongly determined to be /project/src when it should be
> /project.

As I wrote, issue #250952 filed.

> The "create dialogue" can no longer be used. netbeans complains with a
> message "Source folder is already a netbeans project. Maybe in memory only.".

Already reported, issue #250267.

> When creating a project from an unreliable source such as composer.json, all
> project properties should be overridable from the open/create dialogue. I
> suggest notifying the user with a message when 'opening' a project based on
> composer.json.

Again, see issue ##250952.

> But more importantly, change the "create dialogue" to auto
> fill the parameters and also notify the user that they have been guessed
> from composer.json.

Feel free to submit an enhancement for it.

> I wasted 4 hours of work yesterday trying to open an existing project after
> it had become corrupted. If the IDE had given me any indication that it was
> reading the composer.json I could have resolved it in two minutes.

You are using development build of NetBeans which, of course, contains unfinished features (like this one) or which can be even broken.

Thanks for reporting.
Comment 6 Tomas Mysik 2015-03-06 10:41:34 UTC
(In reply to Tomas Mysik from comment #5)
> Already reported, issue #250267.

Funny, this is this issue actually :)
Comment 7 waldermort 2015-03-06 10:59:42 UTC
(In reply to Tomas Mysik from comment #5)
> No, in the Open Project dialog you are opening project, not renaming it.

No, there is no project to open. It is a composer.json file NOT a netbeans project. It's content should not be trusted. Creating a project from such a source is acceptable, as in auto fill editable property attributes, but converting it to a project is not.

> Already reported, issue #250267.
That is this issue.
Comment 8 Tomas Mysik 2015-03-06 11:04:17 UTC
(In reply to waldermort from comment #7)
> No, there is no project to open. It is a composer.json file NOT a netbeans
> project. It's content should not be trusted. Creating a project from such a
> source is acceptable, as in auto fill editable property attributes, but
> converting it to a project is not.

We agreed on this NB behavior and think that it is correct, sorry.

> That is this issue.

Already noticed that, see my previous comment.

Thanks.
Comment 9 Tomas Zezula 2015-07-15 12:57:02 UTC
The new ProjectConvertors.isConvertorProject(p) can be used to exclude artificial projects.
Comment 10 Tomas Mysik 2015-07-16 06:12:49 UTC
Cannot still be fixed, more information in issue #250268. Attaching proposed fix.

Thanks.
Comment 11 Tomas Mysik 2015-07-16 06:13:07 UTC
Created attachment 154665 [details]
proposed fix
Comment 12 Tomas Mysik 2015-07-17 06:45:31 UTC
Done, please verify. Thanks.

http://hg.netbeans.org/web-main/rev/6bfdb0d93457
Comment 13 Quality Engineering 2015-07-18 01:46:39 UTC
Integrated into 'main-silver', will be available in build *201507180001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/6bfdb0d93457
User: Tomas Mysik <tmysik@netbeans.org>
Log: #250267 - New project cannot be created if project dir contains composer.json