Two modules in a project cannot share the same content root


for hour or so I am fighting against:

Content root "C:\Work\Projects\XXXX\Tausch-apk\target\generated-sources\r" is defined for modules "Noser-apklib" and "Remote-apklib".
Two modules in a project cannot share the same content root.

So exuse me venting some steam:

  1. Please: SAVE IT ANYWAY!! — Why, oh why can´t I save an intermediate backup??? It is nice to know there is a bug, but I might want to save it anyway and come back to problem later. I am a proffeisonal software developer: I might fix it by opening the IML file in a text editor.
  2. I fixed it. I deleted all the offending content roots. I double and tripple checked. They are gone!
  3. Last note least: It was not me in the first case. The b**dy Android plugin is adding those faulty content roots. Don't do that. If I wanted them I can add them myself. But I don't: I use a singe content root all the time. I would not deam of doing anything else.

Resume: Another case of a tool trying to assist where no assistence is needed or wanted and it is going horrible wrong in the end. And now I need to click «Cancel» — loose all the other good changes and fix in the IML anyway.



Comment actions Permalink

I begin to wonder if this is a bug and not just nasty usability. It seems that IDEA does not noticen when I delete a content root and just continues to report an allready fixed problem


Comment actions Permalink

What is the project "XXXX"? Do you have different Maven project for these two modules? We add "<PROJECT_TARGET_DIR>/generated-sources/r" as a source root automatically

Comment actions Permalink

Eugene.Kudelevsky schrieb:
What is the project "XXXX"? Do you have different Maven project for these two modules? We add "<PROJECT_TARGET_DIR>/generated-sources/r" as a source root automatically

It is the customer name which I can not tell yet. The Project consists of several Libraries modules, an app module and an instrumentation test module — all of which have seperate Maven modules.

The problem is that the automated maven import often (but not allways) sets the “target/generated-sources/r” and several other directorys relativ to the IML file instead of the POM file. But since we develop on Mac OS X and Window we like to keep the IML files seperate from the source code. The is an appropiate option on the import dialog for that. Here a directory list of what it look like from another project (where the name is not a secret):

/Work/workspaces/UIQ3  Darwin  martin@macpro-eth1  Mo Apr 02 20:06:48  standart  0 
total 352
drwxrwxr-x  12 martin  staff  -       1,3K 29 Dez 15:50 ./
drwxrwxr-x@ 10 martin  staff  -       442B 27 Mär 19:45 ../       32B 
-rw-rw-r--@  1 martin  staff  hidden   12K 29 Dez 15:50 .DS_Store       32B 
drwxrwxr-x   2 martin  staff  -        68B  9 Apr  2010 .backups
drwxrwxr-x   6 martin  staff  -       578B 24 Nov 08:37 .idea/ -rw-rw-r--   1 martin  staff  -         0B 23 Okt 14:53 .lastModified drwxrwxr-x   4 martin  staff  -       612B 28 Dez 10:47 .metadata/ -rw-r--r--   1 martin  staff  -       1,8K 22 Nov 18:42 Calculator-Applet.iml -rw-rw-r--   1 martin  staff  -       1,0K 30 Aug  2011 Calculator-CLDC.iml -rw-r--r--   1 martin  staff  -       1,9K 22 Nov 18:42 Calculator-Desktop.iml -rw-r--r--   1 martin  staff  -       3,2K 22 Nov 18:42 Calculator-Droid.iml -rw-r--r--   1 martin  staff  -       1,7K 22 Nov 18:42 Calculator-SE.iml -rw-rw-r--   1 martin  staff  -       1,9K 28 Okt 19:40 Calculator.iml -rw-r--r--   1 martin  staff  -       2,2K 22 Nov 18:42 FX-602P-Applet.iml -rw-r--r--   1 martin  staff  -       1,1K 14 Nov 18:24 FX-602P-CLDC.iml -rw-r--r--   1 martin  staff  -       3,4K 22 Nov 18:42 FX-602P-Desktop.iml -rw-r--r--   1 martin  staff  -       4,8K 22 Nov 18:50 FX-602P-Droid.iml -rw-r--r--   1 martin  staff  -       1,7K 22 Nov 18:42 FX-602P-SE.iml -rw-r--r--   1 martin  staff  -       2,0K 18 Nov 19:02 FX-602P.iml -rw-r--r--   1 martin  staff  -       3,4K 22 Nov 18:42 FX-603P-Desktop.iml -rw-r--r--   1 martin  staff  -       4,9K 22 Nov 18:50 FX-603P-Droid.iml -rw-r--r--   1 martin  staff  -       1,9K 22 Nov 18:42 FX-603P-SE.iml -rw-r--r--   1 martin  staff  -       2,8K 22 Nov 18:42 FX-603P.iml -rw-r--r--   1 martin  staff  -       1,1K 18 Nov 19:02 HP45-CLDC.iml -rw-r--r--   1 martin  staff  -       4,7K 22 Nov 18:50 HP45-Droid.iml -rw-r--r--   1 martin  staff  -       977B 18 Nov 19:02 HP45.iml -rw-r--r--   1 martin  staff  -       943B 18 Nov 18:48 Informer.iml -rw-r--r--   1 martin  staff  -       2,8K 22 Nov 18:42 Resizeable-Nimbus.iml -rw-rw-r--   1 martin  staff  -       718B 30 Aug  2011 UIQ3.iml drwxrwxr-x   7 martin  staff  -       238B 23 Feb  2011 avd/ -rw-rw-r--   1 martin  staff  -        52K 30 Aug  2011 drwxrwxr-x  24 martin  staff  -       884B 28 Dez 13:01 config/ drwxrwxr-x   6 martin  staff  -       510B 10 Apr  2011 modules/ drwxr-xr-x   4 martin  staff  -       136B 16 Nov 15:11 repository/ drwxrwxr-x   3 martin  staff  -       102B 30 Aug  2011 update/ drwxrwxr-x   2 martin  staff  -       442B 29 Dez 15:50 update_tracking/ drwxrwxr-x   5 martin  staff  -       238B 28 Dez 16:53 var/ /Work/workspaces/UIQ3  Darwin  martin@macpro-eth1  Mo Apr 02 20:06:50  standart  0 >

As you see all the IML files are added to the same directory if the this option is used.


PS: Don't look to close at the path names of the original post — they have been take after an hour of repair (including some copy paste mistakes) and don't represent the original state of affairs. If you wan't to repair the automated import then check that all generated path names are relativ to the POM file.
PPS: For me it would be enough if the maven / android import would not add any content roots — the rest I can fix manualy.


Please sign in to leave a comment.