Creating a Subproject


Although there is no explicit distinction in the IDE between a project and a subproject, you can create a hierarchy of projects by specifying dependencies between projects. For example, you might create an umbrella Web Application project that relies on one or more Java Class Library projects. For larger applications, you might have several layers of project dependencies.

To set dependencies between projects:

  1. Right-click the project's Libraries node and choose Add Project (as shown in Figure 2-4).

    Figure 2-4. Projects window, making one project depend on another

  2. In the file chooser that appears, navigate to the folder for the project you want to depend on and click Add Project. Project folders are designated with the icon.

Once you have established this dependency, the distributed outputs (such as JAR files) of the "added" project become part of the other project's classpath.

There is no visual project/subproject distinction in the IDE, but there is a concept of "main" project. The main project in the IDE is simply the one that the IDE treats as the entry point for the primary commands such as Build Main Project and Run Main Project. The current main project is indicated with bold font in the Projects window.

There can be only one main project set at a time, although it is possible to have multiple projects open at the same time (including umbrella projects that serve as entry points for other applications you are developing).

You can make a project the main project by right-clicking its node in the Projects window and choosing Set Main Project.




NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 279

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net