IntelliJ IDEA 14.0.0 Web Help

Creating a Module by Importing Existing Sources

You can create a module (or a number of modules) by importing a collection of sources available on your computer. Such a collection, in addition to source code files, may also include library, configuration, image and other files.

You can import the sources that come from Eclipse, Flash Builder, Gradle, or Maven. In such cases the corresponding import operations are referred to as importing from an external model.

You can also import the sources of "unspecified origin" (i.e. the sources that come from the systems other than Eclipse, Flash Builder, Gradle, or Maven). In such cases the sources are treated generically and are referred to simply as existing sources.

In technical terms, importing is just creating a module .iml file and adding the module definition to a project file. (If a number of modules is created, one .iml file is created for each of the modules.) In most of the cases, the "original" sources will stay where they are.

To create a module by importing the sources from Eclipse, Flash Builder, Gradle, or Maven

  1. Open the project into which you want to import the sources, and select File | Import Module.
  2. In the dialog that opens, select the directory or file which you want to use as a source of import. This may be a directory that contains the corresponding collection of sources or a file that appropriately describes such a collection. (The possible choices are listed right in the dialog.) Click OK.

    As a result, the Import Module wizard opens. (There is also another way of accessing this wizard, see Opening the Import Module wizard.)

  3. On the first page of the wizard, specify the origin of the sources. (This page is not shown if IntelliJ IDEA has guessed what you are importing.) Select Import module from external model, and select Eclipse, Flash Builder, Gradle, or Maven. Click Next.

To create a module by importing the sources of unspecified origin

  1. Open the project into which you want to import the sources, and select File | Import Module.
  2. In the dialog that opens, select the directory which contains the collection of sources you want to import. Click OK.

    As a result, the Import Module wizard opens. (There is also another way of accessing this wizard, see Opening the Import Module wizard.)

  3. On the first page of the wizard, select Create module from existing sources and click Next.
  4. The next page of the wizard shows the directories in which source files are found. Potentially, these directories may be your source root directories.

    Select the directories which you want to include in your project as the source root directories and click Next.

  5. On the next page of the wizard, select and configure the libraries to be included in your project. Click Next.
  6. On the next page of the wizard, select and configure the modules to be included in your project. Click Next.
  7. The next page of the wizard shows the frameworks and technologies detected in your sources. Select the ones that you want to be enabled and click Finish.

To open the Import Module wizard

See Also

Last modified: 12 November 2014
comments powered by Disqus