Search code examples
javamavenintellij-ideapom.xmlintellij-plugin

Maven can't find some dependencies' components


I'm making a plugin for Intellij IDEA. I tried to build and compile my project with maven and have some problems with com.intellij open sources. Here is my pom.xml dependencies:

     <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>

And here is what I've got when I'm trying to compile or build the project:

[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: I added two more dependencies and now I've got only 1 error left, which I can't solve.

    <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>

The following error:

[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

I opened the location of the interface and there is no such variable but the class called SERVICE with just one static method. Could it be maven've got sick and tried to find variable which is class?


Solution

  • So I resolved the issue by creating dependencies locally. Maven central has too old versions of required intellij libs, so I found the script, which is installing all files in IntelliJ IDEA's lib/ folder to the local maven .m2 repository. I copied from here: github Then created pom.xml file just like in this repository and imported dependencies from the idea version which I have on my machine.