我在旧版本的 NetBeans 中从现有资源创建了一个 PHP 项目。
我现在想在 NetBeans 7.4 中将项目类型更改为 HTML5/CSS 项目。
是否有任何简单的方法可以更改 NetBeans 中现有项目的类型?
我试图避免从现有来源创建新项目,因为我已经配置了所有服务器连接变量。
我在旧版本的 NetBeans 中从现有资源创建了一个 PHP 项目。
我现在想在 NetBeans 7.4 中将项目类型更改为 HTML5/CSS 项目。
是否有任何简单的方法可以更改 NetBeans 中现有项目的类型?
我试图避免从现有来源创建新项目,因为我已经配置了所有服务器连接变量。
项目数据存储在主项目目录中名为 nbproject 的子目录中。
文件 project.xml 包含项目 TYPE 的主要配置数据。类型和数据 xml 命名空间设置决定了基本项目类型。这是一个PHP版本:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.php.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/php-project/1">
<name>codex-slp</name>
</data>
</configuration>
</project>
这是一个 HTML5 项目版本:
<?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>csa</name>
</data>
</configuration>
</project>
注意线路不同。HTML 5 项目使用命名空间 org.netbeans.modules.web.clientproject。PHP 版本位于 org.netbeans.modules.php.project。
另外值得注意的是数据 xmlns 条目,其中 HTML5 指向 clientside-project 目录,而 PHP 指向 php-project 目录。
如何更改项目?不容易。你最好的选择:
这会将项目类型从 PHP 切换到 HTML5,并为您提供相应的对话框。
我决定采用这种方法的原因是这个命名空间规范还有很多其他的东西。例如,project.properties 文件对于 PHP 项目有非常不同的条目,就像 PHP 版本一样,对于 HTML5 项目不存在。HTML5 项目具有 PHP 项目中不存在的新属性。
还有一个完整的私有子目录,它在 private.properties 文件中设置了过多的选项,其中包含诸如 PHP 项目的源远程连接之类的内容,该项目不存在,甚至似乎也不支持 HTML5 项目。
两种项目类型之间存在太多差异,无法简单地破解 nbproject 目录文件并希望它能正常工作。
IMO 您最好的选择是按照上述步骤重新创建项目。
遗憾的是,HTML5 项目类型似乎还没有成熟到 PHP 项目类型的程度,例如支持远程拉/推更改的文件。对于这个特定的项目,我已经恢复为 PHP 项目类型,即使这不是真正的 PHP 项目。我严重依赖通过 FTP 的自动远程服务器推送。我是如何恢复项目的?我将我的 nbproject 目录重命名为 saved_nbproject,所以要恢复:
将来可能会提供更改项目类型和 HTML5 远程服务器支持。目前,对于 NetBeans 7.4,这种转换似乎并不容易实现。
如果其他人有意见或其他反馈,我很乐意听到,因为 NetBeans 已成为我处理复杂代码项目的首选工具。
注意:我强烈建议从现有资源创建一个新项目,以确保一切都按预期工作。在大多数情况下,它更快且问题更少。
(如果你坚持......)
遵循接受的答案可能会导致错误。除了Charleston Software Associates发布的内容外,您可能还需要复制“project.properties”文件中包含的其他变量。
例如,这些是针对PHP的:(适当调整。我建议查看您的一些其他项目以防止出错)。
auxiliary.org-netbeans-modules-php-phpunit.bootstrap_2e_create_2e_tests=false
auxiliary.org-netbeans-modules-php-phpunit.bootstrap_2e_path=
auxiliary.org-netbeans-modules-php-phpunit.configuration_2e_path=
auxiliary.org-netbeans-modules-php-phpunit.customSuite_2e_path=
auxiliary.org-netbeans-modules-php-phpunit.test_2e_run_2e_all=false
ignore.path=
include.path=
php.version=PHP_53
source.encoding=UTF-8
src.dir=/var/www/example
tags.asp=false
tags.short=false
web.root=.
这些适用于 HTML5:
auxiliary.org-netbeans-modules-css-prep.less_2e_compiler_2e_options=
auxiliary.org-netbeans-modules-css-prep.less_2e_enabled=false
auxiliary.org-netbeans-modules-css-prep.less_2e_mappings=/less:/css
auxiliary.org-netbeans-modules-css-prep.sass_2e_compiler_2e_options=--style compressed
auxiliary.org-netbeans-modules-css-prep.sass_2e_configured=true
auxiliary.org-netbeans-modules-css-prep.sass_2e_enabled=true
auxiliary.org-netbeans-modules-css-prep.sass_2e_mappings=/scss:/css
auxiliary.org-netbeans-modules-javascript2-requirejs.enabled=true
auxiliary.org-netbeans-modules-web-clientproject-api.js_2e_libs_2e_folder=js
config.folder=${file.reference.example-config}
file.reference.example-config=config
file.reference.example-test=test
file.reference.www-example=/var/www/example
files.encoding=UTF-8
site.root.folder=${file.reference.www-example}
test.folder=${file.reference.example-test}
您可以将两者混合在一个文件中,没有任何问题。
使用:Netbeans 8.0.1
尝试编辑您的 project.xml 替换类型
<type>org.netbeans.modules.web.clientproject</type>
I tried changing xml and that didn't work well for me. I fiddled around and found a way that seems simpler to me - just delete and create a new project!
Right click the project in netbeans, and click delete. (make sure to NOT check the box that says delete sources!). That clears out the netbeans project info. Then just make a new project of whatever type you want. Go to File->New Project. Select project type (in this case HTML5 Project with existing sources), making sure to select the one that has "with existing sources". Hit next. Now here is a key part. The site root is your mysite/public_html folder most likely. The project directory is your mysite folder. The netbeans config will be put in the mysite folder.
Then you should be good to go!
伙计们,这已针对 7.4 版进行了更改?
在 private.properties 中
remote.connection=remotename
remote.directory=/public_html/
remote.upload=ON_SAVE
run.as=REMOTE
url=http://remotename.com
关闭 Netbeans。
删除应用文件夹中的 nbproject 文件夹。它可以是隐藏文件夹,因此,在 Windows 中,转到文件夹属性并激活隐藏文件夹。
重新打开 Net Bean。创建一个正确类型的新项目。