Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

instrumentCode task fails when targeting local GoLand 2019.3 #910

Closed
YannCebron opened this issue Mar 1, 2022 · 9 comments
Closed

instrumentCode task fails when targeting local GoLand 2019.3 #910

YannCebron opened this issue Mar 1, 2022 · 9 comments
Assignees
Labels
Milestone

Comments

@YannCebron
Copy link
Member

see https://youtrack.jetbrains.com/issue/IDEA-289821 for details

@tarihub
Copy link

tarihub commented Mar 1, 2022

Hello, I was the one who asked the question.
Any further detail can ask for me.
Thanks for your help~

@jeppeman
Copy link
Contributor

jeppeman commented Mar 7, 2022

Hi @TARI0510

Try switching places of you plugin declarations, instead of

plugins {
    id 'org.jetbrains.intellij' version '1.3.0'
    id 'org.jetbrains.kotlin.jvm' version '1.6.0'
    id 'java'
}

Do this

plugins {
    id 'java'
    id 'org.jetbrains.kotlin.jvm' version '1.6.0'
    id 'org.jetbrains.intellij' version '1.3.0'
}

@tarihub
Copy link

tarihub commented Mar 7, 2022

@jeppeman Hello
I use

plugins {
    id 'java'
    id 'org.jetbrains.kotlin.jvm' version '1.6.0'
    id 'org.jetbrains.intellij' version '1.3.0'
}

group 'com.xxx'
version '1.0-SNAPSHOT'

def kotlin_version = "1.6.0"

repositories {
    mavenCentral()
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
    testImplementation "org.mockito.kotlin:mockito-kotlin:4.0.0"
    testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}

// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
    plugins = [
            'org.jetbrains.plugins.go',
            "org.jetbrains.plugins.yaml",
            'org.toml.lang:0.2.120.37-193'
    ]
    localPath = '/Applications/GoLand.app'
    type = 'GO'
    version = '2019.3'
}

patchPluginXml {
    changeNotes = """
      <h2>1.0</h2><br>
      <ul>
        <li></li>
      </ul>
      """
}

test {
    useJUnitPlatform()
}

and get the same exception

Execution failed for task ':instrumentCode'.
> Failed to calculate the value of task ':instrumentCode' property 'compilerClassPathFromMaven'.
   > Could not resolve all files for configuration ':detachedConfiguration4'.
      > Could not resolve com.jetbrains.intellij.java:java-compiler-ant-tasks:193.5233.112.
        Required by:
            project :
         > Could not resolve com.jetbrains.intellij.java:java-compiler-ant-tasks:193.5233.112.
            > Could not get resource 'https://cache-redirector.jetbrains.com/plugins.jetbrains.com/maven/com/jetbrains/intellij/java/java-compiler-ant-tasks/193.5233.112/java-compiler-ant-tasks-193.5233.112.pom'.
               > Could not GET 'https://dtahfujkndrht.cloudfront.net/plugins.jetbrains.com/maven/com/jetbrains/intellij/java/java-compiler-ant-tasks/193.5233.112/java-compiler-ant-tasks-193.5233.112.pom'.
                  > dtahfujkndrht.cloudfront.net:443 failed to respond

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

I think the main problem is we cannot access https://dtahfujkndrht.cloudfront.net/plugins.jetbrains.com/maven/com/jetbrains/intellij/java/java-compiler-ant-tasks/193.5233.112/java-compiler-ant-tasks-193.5233.112.pom or https://cache-redirector.jetbrains.com/plugins.jetbrains.com/maven/com/jetbrains/intellij/java/java-compiler-ant-tasks/193.5233.112/java-compiler-ant-tasks-193.5233.112.pom

@jeppeman
Copy link
Contributor

jeppeman commented Mar 7, 2022

Remove version from the intellij-block:

 intellij {
    plugins = [
            'org.jetbrains.plugins.go',
            "org.jetbrains.plugins.yaml",
            'org.toml.lang:0.2.120.37-193'
    ]
    localPath = '/Applications/GoLand.app'
    type = 'GO'
}

@tarihub
Copy link

tarihub commented Mar 7, 2022

plugins {
    id 'java'
    id 'org.jetbrains.kotlin.jvm' version '1.6.0'
    id 'org.jetbrains.intellij' version '1.3.0'
}

group 'com.xxx'
version '1.0-SNAPSHOT'

def kotlin_version = "1.6.0"

repositories {
    mavenCentral()
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
    testImplementation "org.mockito.kotlin:mockito-kotlin:4.0.0"
    testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}

// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
    plugins = [
            'org.jetbrains.plugins.go',
            "org.jetbrains.plugins.yaml",
            'org.toml.lang:0.2.120.37-193'
    ]
    localPath = '/Applications/GoLand.app'
    type = 'GO'
}

patchPluginXml {
    changeNotes = """
      <h2>1.0</h2><br>
      <ul>
        <li></li>
      </ul>
      """
}

test {
    useJUnitPlatform()
}

After remove version, get another exception

Execution failed for task ':instrumentCode'.
> Failed to calculate the value of task ':instrumentCode' property 'compilerClassPathFromMaven'.
   > Failed to calculate the value of task ':instrumentCode' property 'compilerVersion'.
      > Cannot query the value of extension 'intellij' property 'version' because it has no value available.

@jeppeman
Copy link
Contributor

jeppeman commented Mar 7, 2022

And if you update to 1.4.0 of org.jetbrains.intellij?

@tarihub
Copy link

tarihub commented Mar 7, 2022

I remove version after using org.jetbrains.intellij 1.4.0, It can avoid the exception

Cannot query the value of extension 'intellij' property 'version' because it has no value available.

build.gradle

plugins {
    id 'java'
    id 'org.jetbrains.kotlin.jvm' version '1.6.0'
    id 'org.jetbrains.intellij' version '1.4.0'
}

group 'com.xxx'
version '1.0-SNAPSHOT'

def kotlin_version = "1.6.0"

repositories {
    mavenCentral()
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
    testImplementation "org.mockito.kotlin:mockito-kotlin:4.0.0"
    testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}

// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
    plugins = [
            'org.jetbrains.plugins.go',
            "org.jetbrains.plugins.yaml",
            'org.toml.lang:0.2.120.37-193'
    ]
    localPath = '/Applications/GoLand.app'
    type = 'GO'
}

patchPluginXml {
    changeNotes = """
      <h2>1.0</h2><br>
      <ul>
        <li></li>
      </ul>
      """
}

test {
    useJUnitPlatform()
}

But java-compiler-ant-tasks-193.5233.112.pom still cannot download normally.

Execution failed for task ':instrumentCode'.
> Failed to calculate the value of task ':instrumentCode' property 'compilerClassPathFromMaven'.
   > Could not resolve all files for configuration ':detachedConfiguration4'.
      > Could not find com.jetbrains.intellij.java:java-compiler-ant-tasks:193.5233.112.
        Searched in the following locations:
          - https://repo.maven.apache.org/maven2/com/jetbrains/intellij/java/java-compiler-ant-tasks/193.5233.112/java-compiler-ant-tasks-193.5233.112.pom
          - file:/Applications/GoLand.app/Contents/com.jetbrains.intellij.java/java-compiler-ant-tasks/193.5233.112/ivy-193.5233.112.xml
          - file:/Applications/GoLand.app/Contents/java-compiler-ant-tasks-193.5233.112-2.xml
          - file:/Users/tari/caches/modules-2/files-2.1/com.jetbrains.intellij.idea/com.jetbrains.intellij.java/java-compiler-ant-tasks-193.5233.112-1.xml
          - https://cache-redirector.jetbrains.com/plugins.jetbrains.com/maven/com/jetbrains/intellij/java/java-compiler-ant-tasks/193.5233.112/java-compiler-ant-tasks-193.5233.112.pom
          - https://cache-redirector.jetbrains.com/www.jetbrains.com/intellij-repository/releases/com/jetbrains/intellij/java/java-compiler-ant-tasks/193.5233.112/java-compiler-ant-tasks-193.5233.112.pom
          - https://cache-redirector.jetbrains.com/intellij-dependencies/com/jetbrains/intellij/java/java-compiler-ant-tasks/193.5233.112/java-compiler-ant-tasks-193.5233.112.pom
        Required by:
            project :

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

I try to visit these links, but all of them return 404

@tarihub
Copy link

tarihub commented Mar 11, 2022

@YannCebron @jeppeman I found a temporary solution!

The exception show that it can't find java:java-compiler-ant-tasks:193.5233.112 from IntelliJ repository.

I try to find a nearby version from https://www.jetbrains.com/intellij-repository/releases which is 193.5233.102 and add a block to build.gradle

tasks {
    instrumentCode {
        compilerVersion = "193.5233.102"
    }
}

The complete build.gradle is

plugins {
    id 'java'
    id 'org.jetbrains.kotlin.jvm' version '1.6.0'
    id 'org.jetbrains.intellij' version '1.4.0'
}

group 'com.xxx'
version '1.0-SNAPSHOT'

def kotlin_version = "1.6.0"

repositories {
    mavenCentral()
}

dependencies {
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
    testImplementation "org.mockito.kotlin:mockito-kotlin:4.0.0"
    testImplementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}

// See https://github.com/JetBrains/gradle-intellij-plugin/
intellij {
    plugins = [
            'org.jetbrains.plugins.go',
            "org.jetbrains.plugins.yaml",
            'org.toml.lang:0.2.120.37-193'
    ]
    localPath = '/Applications/GoLand.app'
    type = 'GO'
}

tasks {
    instrumentCode {
        compilerVersion = "193.5233.102"
    }
}

patchPluginXml {
    changeNotes = """
      <h2>1.0</h2><br>
      <ul>
        <li></li>
      </ul>
      """
}

test {
    useJUnitPlatform()
}

Now Goland can boot normally, and my rule also work fine~

But the bug is still existed if we don't specify the tasks block. Hope you can fix it~
Thanks for your guy's help ^_^

@hsz hsz added this to the next milestone Mar 25, 2022
@hsz hsz added the bug label Mar 25, 2022
@hsz
Copy link
Member

hsz commented Mar 25, 2022

Fixed with a2f3837

@hsz hsz closed this as completed Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants