【问题标题】:How to make IntelliJ understand annotations如何让 IntelliJ 理解注解
【发布时间】:2011-05-17 16:48:36
【问题描述】:

我最近从使用 Eclipse 切换到 IntelliJ,我更喜欢这种体验。

但是,IDE 不理解任何注释。我正在使用 Spring @Autowired 注释以及一些 Spring-WS 注释,IDE 告诉我它们尚未解决。

当使用 Maven 构建项目时,它构建良好,并且注释在 Eclipse 中被识别。

我确定这是一个简单的设置,但找不到任何有关如何设置的信息。

【问题讨论】:

  • 您是否已将 Maven 项目正确导入 IntelliJ?然后它应该正确地看到依赖关系。
  • 如果我检查依赖项,那么我可以在那里看到 spring-ws 库,但是没有注释包。
  • 我是个白痴。解决。 IDE 未解析 POM 中的属性。当我将依赖项 ${spring.ws.version} 更改为 2.0.1.RELEASE 时,它起作用了。我现在要解决的新问题。

标签: ide annotations intellij-idea


【解决方案1】:

正如彼得所说,正确导入 Maven 项目时,应正确识别依赖项。 IntelliJ 手册有一个section on how to import a Maven project

【讨论】:

    【解决方案2】:

    作为记录,在我们的项目 pom 中,我们有以下依赖项:

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>3.0.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-orm</artifactId>
            <version>3.0.5.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.ws</groupId>
            <artifactId>spring-ws-core</artifactId>
            <version>2.0.1.RELEASE</version>
        </dependency>
    

    前两者在实现 Web 服务之前就已经存在,因此对于 Web 服务可能并不严格要求它们。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-11-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-09-17
      • 2019-01-31
      • 2016-10-03
      相关资源
      最近更新 更多