NetBeans IDE将Grails应用程序识别为Maven项目

时间:2014-06-23 18:46:36

标签: maven grails netbeans

有没有办法让NetBeans将Grails应用程序识别为Maven项目?我在使用Maven构建的NetBeans中打开了一个Grails应用程序。因为pom.xml中的包装元素包含值'grails-app',而不是诸如war,jar,pom等值,NetBeans将项目标识为Grails应用程序,然后阻止项目解析所有Groovy它需要的服务。以下是用于构建项目的pom.xml的片段:

<artifactId>MPF-SalesQuote</artifactId>
<packaging>grails-app</packaging>
<version>1.0-SNAPSHOT</version>

以下是我尝试运行项目时收到的一些错误消息:

LogoutController.groovy: 18: unable to resolve class   grails.plugin.springsecurity.SpringSecurityUtils
@ line 18, column 1.
 import grails.plugin.springsecurity.SpringSecurityUtils

LogoutController.groovy: 19: unable to resolve class org.springframework.security.access.annotation.Secured
 @ line 19, column 1.
 import org.springframework.security.access.annotation.Secured

UserController.groovy: 4: unable to resolve class org.springframework.security.access.annotation.Secured
@ line 4, column 1.
 import org.springframework.security.access.annotation.Secured
^

我相信如果我能让NetBeans将项目识别为Maven项目而不是Grails应用程序,那么就会解决Groovy服务无法解决的问题。

1 个答案:

答案 0 :(得分:0)

任何带有pom.xml的项目都被认为是maven项目,任何特定于包装的功能都在基础支持之上。

如果您的项目被识别为其他内容,则可能您在基础项目文件夹中有/ nbproject文件夹。在大多数情况下,项目识别排序是硬连线的,而maven pom.xml是在/ nbproject之后。唯一的解决方法Afaik是删除/ nbproject并重新启动ide。那么它应该作为maven项目加载。