Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add a project to build path in IntelliJ Idea

I've recently converted over to IntelliJ Idea 13, previously in eclipse I was able to add a project to another project's build path. I'm not able to accomplish this in IntelliJ.

How can I add project1 to project2's build path so that I can use it as a dependency. I don't want to make that project a JAR because I'm still developing it.

Following this similar previous question: Intellij - Add project dependency like in Eclipse

I was not able to successfully achieve my goal.

In File > Project Structure > Modules

I see the project I'd like to add to my build path (DataProvider) but it's highlighted red, and the bottom warning text states "Invalid item 'DataProvider' in dependencies list'

enter image description here

Any help or assistance would be much appreciated.

Edit:

Solution (Thanks @leeor)

Import project as a module

File > Import Module > (Select Project to be imported)

This will add that project to the project view pane on the left side of the screen.

Then go to your current project

File > Project Structure > Module > (Select your current project)

Under Dependencies

Check mark your project (now a module) you want to import and then click apply and then OK.

Done!

Using IntelliJ Idea 13.1.6 on Mac

like image 694
arabian_albert Avatar asked Jan 16 '16 20:01

arabian_albert


1 Answers

If you want to depend on another module without it being jar, you need to import that as a module into the same project. It doesn't look like DataProvider is imported since it doesn't appear in the module list.

like image 160
leeor Avatar answered Oct 05 '22 04:10

leeor