Publishing intellij plugin

Answered

So i wrote my plugin and now want to publish it in the market place, 

https://plugins.jetbrains.com/docs/intellij/deployment.html 

this article helps a lot however there are two things that aren't specified there. 

1) the article states that the generated token should be set in an environment variable but it is not clarified where said environment variable is to be created and how? 

2) it then states that in the gradle properties some default values for the environment variable should be set. Again how does this look like and how can it be done? 

 

thanks in advance 

 

0
7 comments

Hello,

re 1) "Start by defining an environment variable such as:" refers to system's console to define environment variable

re 2) you can simply add the entry in gradle.properties file with empty value

0

hello thanks for the reply.

1) do you have a link where i can se an example on how to do it? 

2) so it would look like : 

"task{

    "EnvironmentVariableName" = ""

}

 

0

1) open Terminal/Console of your OS

2) no, gradle.properties, not the Gradle build file

Or use https://plugins.jetbrains.com/docs/intellij/deployment.html#using-parameters-for-the-gradle-task approach alternatively.

0

ok i created a gradle.properties file in my main directory and filled it with 

token=<token_value>

also i chose to follow the route that i give the token as argument in the gradle task config rather than the environment variable 

still i get following error 

"Execution failed for task ':publishPlugin'.
> token property must be specified for plugin publishing"

 

did i miss a step or is the gradle.property value of the wrong name ?  

also do i still need the line 

token = System.getenv("ORG_GRADLE_PROJECT_intellijPublishToken") in the gradle task if i use argument instead of environment variable

0

Daniel, the starting point here is the Gradle configuration file with the following part:

publishPlugin {
token = ...
}

This value you can pass to the Gradle using environment variables or properties:

// Provide environment variable, access environment variable
// PUBLISH_TOKEN=foo ./gradlew publishPlugin

publishPlugin {
token = System.getenv("PUBLISH_TOKEN")
}
// Provide environment variable, access project property
// ORG_GRADLE_PROJECT_publishToken=foo ./gradlew publishPlugin

publishPlugin {
token = project.property("publishToken")
}
// Provide project property, access project property
// ./gradlew publishPlugin -PpublishToken=foo

publishPlugin {
token = project.property("publishToken")
}

Note, that storing a secret token in the gradle.properties file isn't a safe solution – it can be accidentally committed to the remote repository.

0

Jakub Chrzanowski In Github, should we keep the publishToken in the Secrets or Variables?

0

Please sign in to leave a comment.