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

Can't create new task based on RunIdeaTask #23

Closed
Virtlink opened this issue Nov 5, 2015 · 4 comments
Closed

Can't create new task based on RunIdeaTask #23

Virtlink opened this issue Nov 5, 2015 · 4 comments
Assignees
Milestone

Comments

@Virtlink
Copy link

Virtlink commented Nov 5, 2015

I'm trying to debug a JPS plugin that's used in an IntelliJ plugin. To do this, I must provide the JVM argument -Dcompiler.process.debug.port=5005 to the IntelliJ process. This causes IntelliJ to wait for a debugger to connect to port 5005. I can do this:

afterEvaluate {
    tasks.getByName('runIdea') {
        jvmArgs += "-Dcompiler.process.debug.port=5005"
    }
}

But I want to do this in a separate task only, so I can still use runIdea without having to connect a debugger. So I tried this instead:

task("debugIdea", type: org.jetbrains.intellij.RunIdeaTask) {
    jvmArgs = ["-Dcompiler.process.debug.port=5005"]
}

But then I get an error about redefining runIdea, even though I'm naming it debugIdea.

Cannot add task ':runIdea' as a task with that name already exists.

How can I keep runIdea as is, but create a new task debugIdea with the JVM arguments I want?

@zolotov zolotov closed this as completed in 58b1332 Nov 5, 2015
@zolotov
Copy link
Member

zolotov commented Nov 5, 2015

0.0.28 will be uploaded soon. Then you can do something like this:

afterEvaluate {
    task("debugIdea", type: org.jetbrains.intellij.RunIdeaTask, group: 'intellij', dependsOn: 'prepareSandbox') {
        jvmArgs += ["-Dcompiler.process.debug.port=5005"]
    }
}

JFY, intellij idea doesn't like (doesn't show in Gradle tool window) tasks from group other with the idea-word in name, so it's better to set any other group for debug task or change its name.

Also, afterEvaluate is still needed, I hope I'll get rid of that in future.

@Virtlink
Copy link
Author

Virtlink commented Nov 5, 2015

Thank you very much for your quick fix and response! I'll test it as soon as your plugin update has been published.

@zolotov
Copy link
Member

zolotov commented Nov 5, 2015

0.0.28 plublished

@Virtlink
Copy link
Author

Virtlink commented Nov 5, 2015

It works just as I wanted, thanks!

@zolotov zolotov added this to the 0.0.28 milestone Dec 5, 2015
@zolotov zolotov self-assigned this Dec 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants