简体   繁体   中英

Sharing a project between Eclipse and Netbeans

有没有办法在Netbeans和Eclipse之间共享相同的* .java文件?

Sharing the Java source files is not the problem - just put them into some source control system, and then import them in both IDEs. Usually the configuration, especially the build process, is the main problem.

In practice, the solution is likely that you maintain separate project configuration files for both IDEs, but use a common build script (eg ant) that is supported by both. The project configuration allows you to use IDE-specific features, while the build script makes sure that both environments produce the same output.

Of course. eclipse supports linked source folders. The sources files don't have to be located in an eclipse project folder.

Inside an eclipse java project, select New -> Folder , then select "Advanced" and check "Link to alternate location" (eclipse 3.6, may be slightly different on other eclipse versions). "Browse" to choose the source folder from the netbeans project, press Finish.

Now you have linked (standard) folder to the Java files inside the netbeans project and modifying those files will modify them at the remote location.

Finally - right-click on this linked folder and choose Build Path -> Use as source folder.

(I leave the other way round to the netbeans experts)

In the ideal case you have your code stored in a version controlled repository (SVN, CVS, etc.). Then it is not as big of a factor whether you are using Eclipse or Netbeans.

This article, taken from a NetBeans 6.2 version of documentation , explains how you can import an Eclipse project into NetBeans and work with both together. NetBeans will create new project files but will link to the Eclipse source files, allowing sharing between the two. I have not tried this yet myself, but may be going down this path soon. After switching to NetBeans just this week, noticed that a significant feature in Eclipse is not in NetBeans - that of being able to create different run configurations that are not incorporated and stored into the POM. At this point in time, I do not have a solution to the run configuration issue, but if you do, please update the SO question here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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