content folder and modules

Hello !

I have tried to setup two modules


Module 1

Content: myjavasources
Source: .
Exclude: com/app/sp
Output: WEB-INF/classes
Java: 1.4.1_02

Module 2

Content: myjavasources
Source: com/app/sp
Output: sp_classes
Java: 1.3.1



Using this configuration, i get the following exception


Error message: It is illegal to share content root between different
modules.
java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:16)
at com.intellij.psi.impl.d.a.q.a(q.java:183)
at com.intellij.ide.i.d.b(d.java:50)
at com.intellij.openapi.projectRoots.b.n.c(n.java:10)
at com.intellij.openapi.roots.a.bf.a(bf.java:66)
at com.intellij.openapi.roots.a.bf.access$400(bf.java:110)
at com.intellij.openapi.roots.a.bf$b_.b(bf$b_.java:5)
at com.intellij.openapi.roots.a.bc.g(bc.java:161)
at com.intellij.openapi.roots.a.v.d(v.java:45)
at com.intellij.openapi.roots.a.v.a(v.java:18)
at com.intellij.openapi.roots.a.y.]]>(y.java:65)
at com.intellij.openapi.roots.a.bc.setJdk(bc.java:355)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)


As you can see, the source-folder of module2 is excluded from the build
in module1. It would be nice, if this situation could be allowed.

If i develop a web-app, and have to maintain database stored procedures
too, i would like to have them controlled within the same cvs tree, but
with different settings (Java Version)

Currently i use a second project. But using modules as "fast switch"
beetween the projects (and other navigation goodies) would be fine


Ciao,
Mario

11 comments

Mario Ivankovits wrote:

Currently i use a second project. But using modules as "fast switch"
beetween the projects (and other navigation goodies) would be fine

Now, i have tried to solve it with a second project, but this wont work too.

If is setup a project like

Content: myjavasources
Source: com/app/sp
Output: sp_classes
Java: 1.3.1

IDEA uses the directories under source as "root" folder. E.g. i cannot
create classes with package com.app.sp withing the source-folder com/app/sp.

Currently it looks like i could not solve this problem.

Any ideas?

Ciao,
Mario

0

2 modules should not have the same content. The reason is that each file can
belong to only one module.

--
Valentin Kipiatkov
JetBrains, Inc
http://www.intellij.com
"Develop with pleasure!"

"Mario Ivankovits" <mario@ops.co.at> wrote in message
news:br4hdo$f5b$1@is.intellij.net...

Hello !

>

I have tried to setup two modules

>
>

Module 1

>

Content: myjavasources
Source: .
Exclude: com/app/sp
Output: WEB-INF/classes
Java: 1.4.1_02

>

Module 2

>

Content: myjavasources
Source: com/app/sp
Output: sp_classes
Java: 1.3.1

>
>
>

Using this configuration, i get the following exception

>
>

Error message: It is illegal to share content root between different
modules.
java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.error(Logger.java:16)
at com.intellij.psi.impl.d.a.q.a(q.java:183)
at com.intellij.ide.i.d.b(d.java:50)
at com.intellij.openapi.projectRoots.b.n.c(n.java:10)
at com.intellij.openapi.roots.a.bf.a(bf.java:66)
at com.intellij.openapi.roots.a.bf.access$400(bf.java:110)
at com.intellij.openapi.roots.a.bf$b_.b(bf$b_.java:5)
at com.intellij.openapi.roots.a.bc.g(bc.java:161)
at com.intellij.openapi.roots.a.v.d(v.java:45)
at com.intellij.openapi.roots.a.v.a(v.java:18)
at com.intellij.openapi.roots.a.y.<init>(y.java:65)
at com.intellij.openapi.roots.a.bc.setJdk(bc.java:355)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

>
>

As you can see, the source-folder of module2 is excluded from the build
in module1. It would be nice, if this situation could be allowed.

>

If i develop a web-app, and have to maintain database stored procedures
too, i would like to have them controlled within the same cvs tree, but
with different settings (Java Version)

>

Currently i use a second project. But using modules as "fast switch"
beetween the projects (and other navigation goodies) would be fine

>
>

Ciao,
Mario



0

Valentin Kipiatkov (JetBrains) wrote:

2 modules should not have the same content. The reason is that each file can
belong to only one module.

I know, and this is why i have tried to exclude this folder from the
other module.
And exactly this folder is the only source for the other module.

So these sources are not shared.

On the other hand. I think IDEA should always use the content-root as
root, and the source-folder only to find the sources to compile.

Currently the source-folder is also the "package root".


Ciao,
Mario

0

Currently the source-folder is also the "package root".


Hmm... Where should we take "package roots" then?

--
Valentin Kipiatkov
JetBrains, Inc
http://www.intellij.com
"Develop with pleasure!"


"Mario Ivankovits" <mario@ops.co.at> wrote in message
news:br6p45$osr$1@is.intellij.net...

Valentin Kipiatkov (JetBrains) wrote:

2 modules should not have the same content. The reason is that each file

can

belong to only one module.

>
I know, and this is why i have tried to exclude this folder from the
other module.
And exactly this folder is the only source for the other module.

>

So these sources are not shared.

>

On the other hand. I think IDEA should always use the content-root as
root, and the source-folder only to find the sources to compile.

>

Currently the source-folder is also the "package root".

>
>

Ciao,
Mario



0

Valentin Kipiatkov (JetBrains) wrote:
>>Currently the source-folder is also the "package root".

Hmm... Where should we take "package roots" then?


As i wrote, the "content-root" (content-entry in modules ui)
Source-Folder and Exclude-Folder should only be used to collect the java
sources.

If i need an second content-entry. By adding additional content entries,
the current multiple-root can be simulated (with the additional
feature to can use the include/exclude feature too)

And it should be possible to let share the modules one content root, if
the sources are not shared (included in module1 but excluded in module2)
. e.g the example i posted before.


It is (currently) also possible to select the target jdk to use for the
module, but the compiler can not be configured.

So if module1 uses the jdk1.4.2 generics enabled compiler, it is
possible to use jdk1.3 for module2 but different settings (no generics,
optmization, additional arguments, ...) are not possible.


I think i miss something with the modules concept, maybe someone can
clarify this for me, but for me it looks like, a module should be
nothing more or less than an project, easily switchable between them
like the modules now.
I think of a "workspace" and add some "projects" to them. However then
the project-root/content-root problematic i described above should be
fixed though.


Ciao,
Mario

0

But wouldn't be sharing the same web files in multiple modules one of
the benefits of being able to configure more than one web root per web
module?

e.g.

A) common/web/...
B) module1/web/...
C) module2/web/...
D) module3/web/...

B through D are three different web modules which would like to share a
common base of pages from A. With the current restriction this would
mean copying and maintaining the exact same files three times in the
above example.

I am not sure if I would be able to configure a set of JSPs and images
as a library which gets copied to the exploded web root but in case the
common part contains TLDs for example, they would not be recognized
during JPS editing.

Valentin Kipiatkov (JetBrains) wrote:

2 modules should not have the same content. The reason is that each file can
belong to only one module.


0

Michael Descher wrote:

But wouldn't be sharing the same web files in multiple modules one of
the benefits of being able to configure more than one web root per web
module?

e.g.

A) common/web/...
B) module1/web/...
C) module2/web/...
D) module3/web/...

B through D are three different web modules which would like to share a
common base of pages from A. With the current restriction this would
mean copying and maintaining the exact same files three times in the
above example.


So setup common as a java module, then make it dependant on the other 3
web modules, then each web module can point to its own webroot.

why would you want to do more than one webroot per webmodule?

R

0

My reasons for multiple webroots:

1) I have TLD files in the common module which I don't want to copy to
all WEB-INF directories.

2) Consider a project where a web application is customized for several
clients. Most of the application is always the same but some parts are
customized. So you have a common webroot with most of the stuff and one
webroot for each client with the specific stuff.

3) IDEA offers multiple webroots per web module. If I cannot share one
directory for multiple web modules, the only use of the feature is to
share common stuff among different projects.

Robert S. Sfeir wrote:

Michael Descher wrote:

>> But wouldn't be sharing the same web files in multiple modules one of
>> the benefits of being able to configure more than one web root per web
>> module?
>>
>> e.g.
>>
>> A) common/web/...
>> B) module1/web/...
>> C) module2/web/...
>> D) module3/web/...
>>
>> B through D are three different web modules which would like to share
>> a common base of pages from A. With the current restriction this would
>> mean copying and maintaining the exact same files three times in the
>> above example.


So setup common as a java module, then make it dependant on the other 3
web modules, then each web module can point to its own webroot.

why would you want to do more than one webroot per webmodule?

R


0

Hum. Ok I can see your point of view. It would be nice not to have to
copy the TLDs and libs over and over to various places. What prevents
you from using one output directory for all your webapps? When you run
the web app, set the clear on make, and it will delete everything and
copy the new files in. This is something you can do now. This way you
can test with 1 set of files copied to one location, and you can change
up all the files to your heart's content.

Maybe I'm not getting it?

R

0

I guess it is not so much the problem of building the webapps. I did not
try but I thought of specifying the TLD directory as a project library
and having it copied to the WEB-INF directory. Might work since you can
give the target path for each library.

My main concern for the TLD stuff is having the taglibs recognized when
editing the JSPs. In this case they have to be physically present in
each web module and that could be achieved using a common webroot with
WEB-INF as location for example.

It is not a serious problem though, since after editing the TLDs a
simple ant task does to the job. Would just be nice to get it done
without ant. ;)

Michael

Robert S. Sfeir wrote:

Hum. Ok I can see your point of view. It would be nice not to have to
copy the TLDs and libs over and over to various places. What prevents
you from using one output directory for all your webapps? When you run
the web app, set the clear on make, and it will delete everything and
copy the new files in. This is something you can do now. This way you
can test with 1 set of files copied to one location, and you can change
up all the files to your heart's content.

Maybe I'm not getting it?

R


0

Michael Descher wrote:

I guess it is not so much the problem of building the webapps. I did not
try but I thought of specifying the TLD directory as a project library
and having it copied to the WEB-INF directory. Might work since you can
give the target path for each library.


It does! This is what I do here. TLD, Libs, JSPs, Media files, Struts
resource files (xml files) they're all modules, which are added as
dependencies to the webapp module, and you can tell it where to deploy
them. Once copy, multiple web apps. Voila!


My main concern for the TLD stuff is having the taglibs recognized when
editing the JSPs. In this case they have to be physically present in
each web module and that could be achieved using a common webroot with
WEB-INF as location for example.


YES! That I agree with. I've filed a feature request for it because if
we set things up the way they're 'indended' to be setup, then we need to
somehow have any module which is dependant on the webapp module, to
resolve web.xml and the tlds. I don't know how they're going to do
this, but this is the direction they took web modules in, and I'm sure
they have something in mind for it.


It is not a serious problem though, since after editing the TLDs a
simple ant task does to the job. Would just be nice to get it done
without ant. ;)


Yes. Ant for me is perfect for making builds to deploy, not build and
run in idea builds. Although the creation of the war file has pretty
much elliminated that need too.

R

0

Please sign in to leave a comment.