groovy directory looses "source" status

Hello
something annoying:
in a big maven project with many modules I have some directories that deal with groovy sources
they are marked as "source" (or test source)
sometime when I restart the IDEA they loose this status and appear as a normal directory without source status
I am obliged to scan the modules and tag again every groovy directory as source
So what am I doing in a wrong way? what should I do to have these directories retain their source status?
thanks
PS : IDEA version 11.1.4

16 comments

Hi Bernard,

Do those directories follow standard maven conventions (src/main/groovy)?

Are there any exceptions at idea.log when the problem occurs?

Denis

0

they are in src/main/groovy
not aware of any log
there are so many of these!
more notably recurrent problem
------------------------------------------------
WARN - pi.vfs.impl.jar.JarHandlerBase - error in opening zip file: /Users/bamade/Devt/Java/Lsst2012/CameraControl/org-lsst-ccs-config/trunk/pom.xml
java.util.zip.ZipException: error in opening zip file
-- stacktrace
--------------------------------------------------------------------
this happens constantly (and BTW seems to cause problems with dependencies that are not correctly set in each module settings (I have to modify module settings manually)
but this is another story .... (maven and IntelliJ do not like each other X-( ...)
------
losing groovy source status  happens in an haphazard way (sometimes yes sometimes not)
but it is annoying since everytime IDEA is restated: runs fails because it lacks some classes, then I have to mark some groovy directories as source (there are many of themà) and do it again


note
on idea.log i get this
----------------------------------------------
2012-12-13 15:55:22,598 [ 979930]  ERROR - .roots.impl.DirectoryIndexImpl - IntelliJ IDEA 12.0  Build #IU-123.72
2012-12-13 15:55:22,598 [ 979930]  ERROR - .roots.impl.DirectoryIndexImpl - JDK: 1.6.0_35
2012-12-13 15:55:22,598 [ 979930]  ERROR - .roots.impl.DirectoryIndexImpl - VM: Java HotSpot(TM) 64-Bit Server VM
2012-12-13 15:55:22,598 [ 979930]  ERROR - .roots.impl.DirectoryIndexImpl - Vendor: Apple Inc.
2012-12-13 15:55:22,598 [ 979930]  ERROR - .roots.impl.DirectoryIndexImpl - OS: Mac OS X
2012-12-13 15:55:22,598 [ 979930]  ERROR - .roots.impl.DirectoryIndexImpl - Directory index is not initialized yet for Project (Default) Default (Template) Project
java.lang.Throwable
        at com.intellij.openapi.diagnostic.Logger.error(Logger.java:54)
        at com.intellij.openapi.roots.impl.DirectoryIndexImpl.a(DirectoryIndexImpl.java:249)
        at com.intellij.openapi.roots.impl.DirectoryIndexImpl.getInfoForDirectory(DirectoryIndexImpl.java:168)
        at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.a(ProjectFileIndexImpl.java:85)
        at com.intellij.openapi.roots.impl.ProjectFileIndexImpl.isIgnored(ProjectFileIndexImpl.java:107)
        at org.jetbrains.plugins.groovy.compiler.GroovyCompilerConfigurable$1.isFileVisible(GroovyCompilerConfigurable.java:69)
        at com.intellij.openapi.fileChooser.impl.FileTreeStructure.a(FileTreeStructure.java:115)
        at com.intellij.openapi.fileChooser.impl.FileTreeStructure.getChildElements(FileTreeStructure.java:77)
        at com.intellij.ide.util.treeView.AbstractTreeUi$31.run(AbstractTreeUi.java:1618)

probably something strange ....

0

another annoying feature:
I have a groovy file which is in a "resources" directory
why that?: because it is a groovy DSL that is read and executed by another module of the application during execution of the app.
I am obliged to unmark the resources directory as "source" otherwise the make command will try to compile the groovy file ... and it can't!
is there a better option?
(this said the disappearing property of groovy directory as "source" is still appearing /disappearing in a completely haphazard way ?:| : I discover this when the project refuses to be built because it lacks the corresponding classes....)

0

IDEA 13 has got new type of roots: resource roots, similar to Maven resources.

Not sure is there anything in IDEA 11, more suitable than you've found.

Regards,
Alexander.

0

thanks: I will investigate
this said
I am running now the latest version of IntelliJ
and the curious behaviour of the disappearing of groovy "source" status remains: though I change the status of groovy subdirectory in src to source
then when I restart the IDE this status may be lost
what is maddening is that it does not happen for every module (sometimes yes sometimes no)
this said IntelliJ is the greatest IDE for handling Groovy (and Groovy DSL!!!)
so thanks again to the team!

0

What is the number of the latest version of IDEA you run?

Thanks,
Alexander.

0

It's IDEA 12. While new type of resource directories are introduced in IDEA 13.

Alexander.

0

ok : was confused because on MAC my icon says "Intellij IDEA 13"
!

0

I downloaded version 13 early version
advantage: now the bug is not random: it is systematic: all groovy directories lose "source" status!!! X-(
how come?
language level changed -> restart-> again every groovy directory source status lost! this is driving me mad!

0

Sorry, that does not happen to me. Could you show any of your poms that behaves so?

Thank you,
Alexander.

0

the first two poms inherit form an older version number of the parent pom (#3)
but this later one had nothing changed in its content
this is one of the examples where this happens (and probably the simplest)



Attachment(s):
pom.xml
pom.xml
pom.xml
0

Thank you.

I see that no one of these poms refers to gmaven plugin. (One pom contain the reference, but commented.) Is that by intention?

When I add a plugin configuration like:

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.gmaven</groupId>
                <artifactId>gmaven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

Then my src/main/groovy and src/test/groovy are picked up.

Thanks,
Alexander.

0

yes it was intentional
the gmaven utilities does not work well with our codes that mixes groovy and java and that's why we moved to the eclipse one.
Is really the "groovy as source" dependent on the gmaven presence in the pom?
why that?

thanks

0

Ok. Please try: Settings dialog / Maven / Importing / Keep source and test folders on reimport = Yes. And set "source" flag again after that.

Thank you,
Alexander.

0

tried
thought it worked the first day
but does not work any more ....

0

Please sign in to leave a comment.