14

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

Community
  • 1
  • 1
arabian_albert
  • 708
  • 1
  • 11
  • 24
  • I tried these steps but couldn't get it working. I'm migrating from Eclipse and am not sure what may be going wrong. Both the projects which I want to import from Eclipse are maven based. I did exactly same steps as you mentioned. But IDEA still complains and doesn't recognize the dependancy added – vikramvi May 29 '17 at 14:00
  • can you please add the screen shot of the current working dependent module on project ? – vikramvi Jun 26 '17 at 12:26

1 Answers1

5

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.

leeor
  • 17,041
  • 6
  • 34
  • 60
  • @leeor does this work for you with current version of IDEA ? I'm struggling to get it working from last 1 day but no success yet. – vikramvi Jun 26 '17 at 12:25