简体   繁体   English

如何创建包装jedit源代码的netbeans 7.3项目?

[英]How can I create a netbeans 7.3 project wrapping the jedit source code?

I thought this is an easy question because there's already a wiki topic about this here especially this section. 我认为这是一个简单的问题,因为已经有关于这个维基话题在这里尤其是本节。 however the wiki is out of date. 但是Wiki已过期。 A prior question exists here on Stackoverflow that only has a reference to these now out of date wiki topics. 这里有一个关于Stackoverflow的先前的问题,该问题仅引用了这些现在过时的Wiki主题。 The netbeans wiki must be for some older version of NetBeans UI, and I'm using NetBeans 7.3. netbeans Wiki必须用于某些较旧版本的NetBeans UI,并且我正在使用NetBeans 7.3。

If I try to use the existing sources option in 7.3 it assumes that you cannot have a build.xml already, and so it tells you you cannot proceed: 如果我尝试使用7.3中的现存源选项,则假定您已经不能拥有build.xml,因此它告诉您无法继续:

在此处输入图片说明

For illustration purposes it may help to show some structure of jedit source code folders. 出于说明目的,它可能有助于显示jedit源代码文件夹的某些结构。 I have both the latest jEdit source code and the 5.0 stable source code. 我同时拥有最新的jEdit源代码和5.0稳定源代码。 The project layout is roughly like this: 项目布局大致如下:

      + jedit
        |
        +- org
        |
        +- net
        |
        +- test
        |
        +- de
        |
        ....

I have located the folder where the root build.xml is located, but I cannot follow the wiki instructions because there does not appear to be such a project-with-existing-ant-build-script option anymore. 我已经找到了root build.xml所在的文件夹,但是我无法按照wiki的说明进行操作,因为似乎不再有这样的project-with-existing-ant-build-script选项。

And Now We Try the Free-Form option... and it doesn't work either... 现在,我们尝试使用自由格式选项...而且它也不起作用...

The free-form project works in so far is that it lets you create a netbeans project, but the scan of the directory results in a complete mess inside netbeans. 到目前为止,自由格式项目的工作在于它可以让您创建一个netbeans项目,但是对目录的扫描会导致netbeans内部完全混乱。 A series of folders with path "." 一系列路径为“。”的文件夹。 are added, 5 copies of a duplicate "." 添加,重复的“。”的5个副本。 folder, and 5 duplicate "Source Packages" entries in the project tree view. 文件夹,以及项目树视图中的5个重复的“源包”条目。 This may be related to the second problem with free-form which is that it will not build and run jEdit, but dies with a strange error message that does not happen when I try to build outside netbeans: 这可能与自由格式的第二个问题有关,即它不会生成和运行jEdit,但会死于一条奇怪的错误消息,当我尝试在netbeans外部构建时不会发生此错误消息:

The mess in the project pane, leaves me unable to navigate or see the source structure: 项目窗格中的混乱情况使我无法浏览或查看源代码结构:

在此处输入图片说明

And it doesn't build: 而且它没有建立:

Processing /Users/admin/NetBeansProjects/jedit/trunk/build/test/merged-reports/TESTS-TestSuites.xml to /var/folders/59/mc8gzxfn1b98j389rkz4zjsc0000gs/T/null666107982
Loading stylesheet jar:file:/Applications/NetBeans/NetBeans%207.3.app/Contents/Resources/NetBeans/java/ant/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs/optional/junit/xsl/junit-frames.xsl
: Error! The first argument to the non-static Java function 'replace' is not a valid object reference.
: Error! Cannot convert data-type 'void' to 'reference'.
: Fatal Error! Could not compile stylesheet
Failed to process /Users/admin/NetBeansProjects/jedit/trunk/build/test/merged-reports/TESTS-TestSuites.xml
/Users/admin/NetBeansProjects/jedit/trunk/build.xml:442: Errors while applying transformations: Fatal error during transformation
BUILD FAILED (total time: 35 seconds)

So I gave up on the free-form project because it doesn't build. 所以我放弃了自由格式项目,因为它没有构建。

And now on to opening a project with existing sources after removing the build folder and build.xml which doesn't work either... 现在,在删除build文件夹和build.xml之后,使用现有资源打开一个项目,该方法也不起作用...

If I want to import project sourcecode (just the java, no build.xml because I deleted it), I get stuck here: 如果我想导入项目源代码(只是java,没有build.xml,因为我将其删除了),我会卡在这里:

在此处输入图片说明

What did I try to do? 我想做什么? I tried to add the source folders, as directories under org , de and net (see the source tree I put above in my question). 我试图将源文件夹添加为orgdenet下的目录(请参阅我在问题中放在上面的源树)。 However netbeans automatically traverses upwards to the ROOT folder of my source code. 但是,netbeans会自动向上遍历到我的源代码的ROOT文件夹。

I am unable to select any folder OTHER than the root because selecting a folder underneath it leads to Netbeans unhelpfully always moving back up the folder hierarchy until it arrives where it wants to be. 我无法选择除根目录以外的任何其他文件夹,因为选择它下面的文件夹会导致Netbeans总是无助地一直向上移动文件夹层次结构,直到到达所需位置为止。 It won't be told any different. 不会有任何不同。

This in turn leads to netbeans complaining about something it decided to do to me, which is that it can't include jedit/test because it's using jedit as the root source folder. 反过来,这导致netbeans抱怨它决定对我做某事,因为它使用jedit作为根源文件夹,因此它不能包含jedit/test Nothing I select (however many folders below jedit/) results in netbeans doing anything differently. 我没有选择(但jedit /下有许多文件夹)导致netbeans做任何不同的事情。 It insists on traversing back through subdirectories in an effort to be helpful. 它坚持要遍历子目录,以提供帮助。 I am beginning to think that the real world users of java may organize their source code in a way that netbeans cannot handle. 我开始认为,现实世界中的Java用户可能会以netbeans无法处理的方式来组织源代码。

Other Information 其他资讯

  • Building from the shell with ant against the default build.xml shipping with the sources of jedit works fine, as long as you have a modern version of ant. 只要您具有最新版本的ant,就可以使用默认的jedit源码从默认的build.xml附带的ant用shell进行构建。 Reinstalling ant fixed my command line build abilities. 重新安装ant修复了我的命令行构建功能。

  • I found that I had to install the latest ant version from the apache website before my Mac OS X box would build jEdit 5.0 at the command line. 我发现必须先从apache网站安装最新的ant版本,然后Mac OS X才能在命令行上构建jEdit 5.0。 The ant version inside my netbeans app bundle may be different. 我的netbeans应用程序捆绑包中的ant版本可能有所不同。

  • I am using OS X 10.8 and hava Java 1.5, 1.6, and 1.7 installed, currently building against java 1.6. 我正在使用OS X 10.8并安装了Java 1.5、1.6和1.7,目前针对Java 1.6进行了构建。

  • It seems to me that Netbeans opens Maven projects with aplomb and grace and this in turn is due to Maven projects generally following standard java directory layouts. 在我看来,Netbeans轻松而优雅地打开了Maven项目,这又是由于Maven项目通常遵循标准的Java目录布局。 Ant-based builds also seem to import nicely to the extent that naming and layout standards are intelligible to Netbeans, but jEdit appears to be something that Netbeans can't cleanly handle in its current form. 在基于命名和布局标准的Netbeans可以理解的程度上,基于Ant的构建也可以很好地导入,但是jEdit似乎是Netbeans无法以其当前形式干净处理的东西。

The URL below has instructions to setup and compile jEdit 5.0.0 source in NetBeans 7.3. 下面的URL包含在NetBeans 7.3中设置和编译jEdit 5.0.0源的说明。

http://www.areaofthoughts.com/2013/01/compiling-running-jedit-5-in-netbeans-73.html http://www.areaofthoughts.com/2013/01/compiling-running-jedit-5-in-netbeans-73.html

Summary: 摘要:

  • jsr305-2.0.1.jar dependency must be downloaded and added manually to netbeans Libraries tab or else javax.annotation.Nonnull and javax.annotation.Nullable will not resolve. jsr305-2.0.1.jar依赖关系必须下载并手动添加到netbeans“库”选项卡中,否则javax.annotation.Nonnulljavax.annotation.Nullable将无法解析。

  • Unpacking the jedit source code to a subdirectory 1 level underneath the folder that will be the netbeans project is essential . 将jedit源代码解压到将成为netbeans项目的文件夹下的1级子目录是至关重要的

The screen shot states that /Users/admin/NetBeansProject/jedit/trunk already contains a build.xml file. 屏幕快照显示/Users/admin/NetBeansProject/jedit/trunk已包含build.xml文件。 You should try creating a "Freeform Project" in NetBeans instead of a "New Java Project with Existing Sources". 您应该尝试在NetBeans中创建“自由格式项目”,而不是“具有现有源的新Java项目”。

If you don't want to reuse the existing build.xml file, you can copy your source files to a new directory. 如果您不想重复使用现有的build.xml文件,则可以将源文件复制到新目录。 In particular, you should place them in the src subdirectory of an otherwise empty directory for the NetBeans project. 特别是,您应该将它们放在NetBeans项目的否则为空目录的src子目录中。 Then you can create a "New Java Project with Existing Sources." 然后,您可以创建“具有现有源的新Java项目”。 You shouldn't need to create your own Ant build file unless you need to add custom tasks or customize the default ones which are generated by NetBeans. 除非您需要添加自定义任务或自定义NetBeans生成的默认任务,否则您无需创建自己的Ant构建文件。

I can't comment on using Netbeans for Java, as I code PHP with it only. 我无法评论将Netbeans用于Java,因为我仅使用它编写PHP。 But when loading a project with existing PHP sources, I can save my project configuration file in the project or at another location (and I do sometimes save the project config to my windows profile, as the sources are on a samba share on my linux web server) 但是,当使用现有的PHP源代码加载项目时,我可以将项目配置文件保存在项目中或其他位置(有时我确实将项目配置保存到Windows配置文件中,因为源代码位于Linux网络上的samba共享中服务器)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM