Maven找不到一些依赖项的组件

时间:2016-02-16 13:27:44

标签: java maven intellij-idea pom.xml intellij-plugin

我正在为Intellij IDEA制作一个插件。我尝试使用maven构建和编译我的项目,并且在com.intellij开源方面遇到了一些问题。这是我的pom.xml依赖项:

     <properties>
        <java.version>1.7</java.version>
        <org.apache.maven.plugins.compiler.version>3.5</org.apache.maven.plugins.compiler.version>
        <intellij.openapi.version>7.0.3</intellij.openapi.version>
        <intellij.annotations.version>12.0</intellij.annotations.version>
        <intellij.forms_rt.version>7.0.3</intellij.forms_rt.version>
        <intellij.openapi.version>7.0.3</intellij.openapi.version>
        <intellij.extensions.version>7.0.3</intellij.extensions.version>
        <intellij.java2c.version>7.0.3</intellij.java2c.version>
    </properties>
    </dependencies>
        <dependency>
            <groupId>com.intellij</groupId>
            <artifactId>openapi</artifactId>
            <version>${intellij.openapi.version}</version>
        </dependency>
        <dependency>
            <groupId>com.intellij</groupId>
            <artifactId>annotations</artifactId>
            <version>${intellij.annotations.version}</version>
        </dependency>
        <dependency>
            <groupId>com.intellij</groupId>
            <artifactId>forms_rt</artifactId>
            <version>${intellij.forms_rt.version}</version>
        </dependency>
        <dependency>
            <groupId>com.intellij</groupId>
            <artifactId>extensions</artifactId>
            <version>${intellij.extensions.version}</version>
        </dependency>
        <dependency>
            <groupId>com.intellij</groupId>
            <artifactId>javac2</artifactId>
            <version>${intellij.java2c.version}</version>
        </dependency>
    </dependencies>

以下是我在尝试编译或构建项目时所获得的内容:

[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/student/Dev/gs-idea-plugin/main/java/com/company/ap/gigaspaces/plugin/PrimaryToolWindowFactory.java:[6,40] package com.intellij.openapi.editor.impl does not exist
[ERROR] /home/student/Dev/gs-idea-plugin/main/java/com/company/ap/gigaspaces/plugin/PrimaryToolWindowFactory.java:[11,31] cannot find symbol
  symbol:   class ToolWindowFactory
  location: package com.intellij.openapi.wm
[ERROR] /home/student/Dev/gs-idea-plugin/main/java/com/company/ap/gigaspaces/plugin/PrimaryToolWindowFactory.java:[13,34] cannot find symbol
  symbol:   class JBList
  location: package com.intellij.ui.components
[ERROR] /home/student/Dev/gs-idea-plugin/main/java/com/company/ap/gigaspaces/plugin/PrimaryToolWindowFactory.java:[34,50] cannot find symbol
  symbol: class ToolWindowFactory
[ERROR] /home/student/Dev/gs-idea-plugin/main/java/com/company/ap/gigaspaces/plugin/PrimaryToolWindowFactory.java:[42,13] cannot find symbol
  symbol:   class JBList
  location: class com.company.ap.gigaspaces.plugin.PrimaryToolWindowFactory
[ERROR] /home/student/Dev/gs-idea-plugin/main/java/com/company/ap/gigaspaces/plugin/PrimaryToolWindowFactory.java:[362,13] cannot find symbol
  symbol:   class EditorHeaderComponent
  location: class com.company.ap.gigaspaces.plugin.PrimaryToolWindowFactory
[ERROR] /home/student/Dev/gs-idea-plugin/main/java/com/company/ap/gigaspaces/plugin/PrimaryToolWindowFactory.java:[79,55] cannot find symbol
  symbol:   variable SERVICE
  location: interface com.intellij.ui.content.ContentFactory
[ERROR] /home/student/Dev/gs-idea-plugin/main/java/com/company/ap/gigaspaces/plugin/PrimaryToolWindowFactory.java:[58,5] method does not override or implement a method from a supertype
[ERROR] /home/student/Dev/gs-idea-plugin/main/java/com/company/ap/gigaspaces/plugin/PrimaryToolWindowFactory.java:[263,9] cannot find symbol
  symbol:   class EditorHeaderComponent
  location: class com.company.ap.gigaspaces.plugin.PrimaryToolWindowFactory
[ERROR] /home/student/Dev/gs-idea-plugin/main/java/com/company/ap/gigaspaces/plugin/PrimaryToolWindowFactory.java:[363,9] cannot find symbol
  symbol:   class EditorHeaderComponent
  location: class com.company.ap.gigaspaces.plugin.PrimaryToolWindowFactory
[ERROR] /home/student/Dev/gs-idea-plugin/main/java/com/company/ap/gigaspaces/plugin/PrimaryToolWindowFactory.java:[363,44] cannot find symbol
  symbol:   class EditorHeaderComponent
  location: class com.company.ap.gigaspaces.plugin.PrimaryToolWindowFactory

UPDATE:我添加了两个依赖项,现在我只剩下1个错误,我无法解决。

    <dependency>
        <groupId>com.github.adedayo.intellij.sdk</groupId>
        <artifactId>platform-impl</artifactId>
        <version>142.1</version>
    </dependency>
    <dependency>
        <groupId>com.github.adedayo.intellij.sdk</groupId>
        <artifactId>platform-api</artifactId>
        <version>142.1</version>
    </dependency>

以下错误:

[ERROR] /home/student/Dev/gs-idea-plugin/main/java/com/company/ap/gigaspaces/plugin/PrimaryToolWindowFactory.java:[79,55] cannot find symbol
[ERROR] symbol:   variable SERVICE
[ERROR] location: interface com.intellij.ui.content.ContentFactory

我打开了界面的位置,没有这样的变量,只有一个名为SERVICE的类只有一个静态方法。可能是maven病了,并试图找到类的变量?

2 个答案:

答案 0 :(得分:0)

日志表明Maven设法解决了你的依赖关系(否则,它甚至不会调用编译器)。

你需要修复你的java类,因为它们是有编译问题的(你的类中都包含所有的导入吗?)。

答案 1 :(得分:0)

所以我通过在本地创建依赖项解决了这个问题。 Maven Central有太旧版本的所需intellij库,所以我找到了脚本,它将IntelliJ IDEA的lib /文件夹中的所有文件安装到本地maven .m2存储库。我从这里复制了:github然后就像在这个存储库中创建了pom.xml文件,并从我在我的机器上的想法版本中导入了依赖项。