IntelliJ IDEA 2016.3 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 Bnd/Bndtools, 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.

Creating 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 | New | Module from Existing Sources.
  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 Bnd/Bndtools, Eclipse, Flash Builder, Gradle, or Maven. Click Next.

The next steps depend on the origin of the sources that you are importing. For corresponding instructions, see:

Creating a module by importing the sources of unspecified origin

  1. Open the project into which you want to import the sources, and select File | New | Module from Existing Sources.
  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.

Opening the Import Module wizard

Provided that a project is open in IntelliJ IDEA, you can access the Import Module wizard from:

  • The main menu: File | New | Module from Existing Sources.
  • The Project Structure dialog: in the leftmost pane select Modules, above the pane to the right click /help/img/idea/2016.3/new.png and select Import Module.

See Also

Last modified: 21 March 2017