Maven: resource concept mismatch

The following is the excerpt from maven documentation on resources element of build settings from pom.xml:
"Another feature of build elements is specifying where resources exist within your project. Resources are not (usually) code. They are not compiled, but are items meant to be bundled within your project or used for various other reasons, such as code generation."
The key point here is that directories mark as resourcea are NOT compiled. If I define such resource in my pom.xml IDEA will add this directory as a source dir upon maven project synchronisation. Suppose I have a java class in one of the 'resource' directories which is intentionally not compilable (this can happen for GWT 'translatable' classes for instance). I will not be able to compile such project from IDEA (using 'rebuild project' menu item) while the project will be successfully compiled when using maven. Moreover, when packaging such project using maven the package will contain java source code from resource directories while if doing the same via IDEA the package will contain compiled java classes from the resource directories.
Looks to me like a concept mismatch. IDEA treats such resource- directories like a source directories while it is more like classpath dirs (but not 100% since the content of such directories must be copied to the output dir as it is in the resource dir).

Sergey.

2 comments
Comment actions Permalink

I'm afraid there is no way to represent maven's 'resource' concept in IDEA exactly.
Does this issue causes real problem?

0
Comment actions Permalink

Well, it does cause a bit of a problem when I work on GWT stuff. There are situations where I need to have a java class which is not correct in terms of java but is correct for GWT. It is of course not a critical problem as I can always resort to manual project/module configuration but it would of course be nice if I only have to configure my stuff in pom.xml and idea will automatically generate iml/ipr files which work out of the box. A better option would perhaps be that directories marked as 'resource' directories in my pom.xml would end up as classpath directories in my idea modules. There are other complications (like you can specify filters for resource directories and I do not think idea can support this) but having my 'resource' directories added to the classpath instead of marking them as source directories will improve maven-idea project synchronisation

0

Please sign in to leave a comment.