2

在不使用 NetBeans IDE 本身的情况下,将 NetBeans (Matisse) .form 文件转换为 .java 文件的最佳方法是什么?理想情况下,我想将 .form 文件与我的源代码一起打包,并在构建时生成 .java 文件。这将防止开发人员“意外”使用其他 IDE 将代码添加到生成的 .java 文件中,这样下次在 GUI 设计器中编辑表单本身时,NetBeans 可能会覆盖这些代码。

我搜索了谷歌,我只能找到人们说“使用 NetBeans IDE 生成 .java 文件”,这在构建时很难做到。

4

2 回答 2

1

Well, actually having to fight with "accidental" addition of codes is more a problem of process rather than a problem with technology. My steps would be:

  1. Prevent committing the generated .java files in the CVS/SVN repository
  2. Embed matisse form generation in a continuous integration project.

For step 1: Use a sensible naming convention and stick with the standard for all the gui object, e.g.: put all the forms inside a common package and use the .svnignore directive on java files in it.

For step 2: Fabrizio Giudici has a nice tutorial on how to build a netbeans project (yes using matisse) inside a continuous integration environment.

http://weblogs.java.net/blog/fabriziogiudici/archive/2006/11/setting_up_netb.html

Note that he talks about installing netbeans first on a machine with a gui then moving the jar files in an headless machine. IIRC it was possible to install Netbeans version 4.x in an headless environment without using the gui (since it is a java application, the only steps to do were to unzip the files and create a sensible shell file launching the application with the correct jvm/classpath combo).

Anyway, if you can't enforce both rules, or you can't find how to generate the matisse artifacts in the CI server, consider the possibility to scrap the use of matisse entirely.

于 2008-11-05T10:04:54.480 回答
0
  • 从Netbeans复制代码并将其粘贴到JCREATOR中。
  • 保存文件。
  • 如果它需要任何名称,请写下您在Netbean中创建的类的名称。
  • 保存。
  • 在JCREATOR中运行代码。
  • 它会自动将您的文件转换为.java.class.
  • 玩得开心,欢呼。
于 2013-12-24T12:47:25.663 回答