Groovy 和 IntelliJ - 编译代码 [英] Groovy and IntelliJ - getting code compiled

查看:26
本文介绍了Groovy 和 IntelliJ - 编译代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个项目中有 IntelliJ 12 和一些 groovy 代码(以及一堆 java 代码).

I have IntelliJ 12 and some groovy code (along with a pile of java code) in a project.

在 intelliJ 中,我可以看到 A 类导入了一些 groovy 代码,并且我还包含了包含该代码的库.

In intelliJ, i can see class A's import of some groovy code, and i have also included the library that has that code.

然而,虽然包本身是一种颜色(用于导入),但实际导入的类是红色的,这意味着某种问题.将鼠标悬停在它上面显示没有问题.

However, while the package itself is in one colour (for the import), the actual class being imported is in red, which implies an issue of some sort. Hovering the mouse over it reveals no issue though.

当我运行make"或重建项目"时,问题就开始了——我明白了

When i run a "make" or a "rebuild project" is where the problems start - i get

Groovyc: unable to resolve class com.blah.blah.blah.A

我该如何解决这个问题?

How can i resolve this?

目前,我的项目设置是这样的:

Currently, my project setup is like so:

在(项目结构 -> 项目设置 -> 库)中的库"下,我有:

Under "Libraries" in (Project Structure -> Project Settings -> Libraries) I have:

包含所有常规代码的 jar 文件包含所有常规代码的 src jar 文件

the jar file with all the groovy code the src jar file with all the groovy code

在模块"部分中,我有 - 好吧,我不知道该怎么称呼它,该列没有标记 - 与 src 和类文件相关联的库部分中的库名称,以及小旁边的导出"按钮被打勾.

In the "Modules" section i have the - well, i don't know what to call it, the column isn't labelled - the library name from the libraries section associated with the src and class files, and the little "export" button beside it is ticked.

顺便说一句,在 intelliJ 中打开类从不显示源代码,鉴于包含源代码,这让我觉得很奇怪.

Incidentally, opening the class in intelliJ never shows the source code, which given the source is included struck me as weird.

还有什么我需要做的吗?

我已经解决了这个问题,但是如果有人知道为什么 groovy 不能出现在资源模式"列表中并想要投票,请加入

推荐答案

哦,对了.

我从 File : Settings -> 中的条目列表中删除了 !?*.groovy 条目编译器 ->资源模式 东西.

I removed the !?*.groovy entry from the list of, um, entries in the File : Settings -> Compiler -> Resource Patterns thingy.

使用外部构建" 是打开还是关闭似乎并不重要,但是 !?*.groovy;条目不能在那里.

It doesn't seem to matter if "use external build" is on or off for this, but the !?*.groovy; entry cannot be there.

不知道有没有人知道为什么?

I wonder if anybody knows why?

这篇关于Groovy 和 IntelliJ - 编译代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆