Skip to content

Use CloudRepo from IntelliJ IDEA

View as Markdown

IntelliJ IDEA runs your Maven and Gradle builds, and CloudRepo is a Maven repository, so there is no CloudRepo setting in the IDE. Set up the build tool, then check that the IDE reads that setup. The same goes for the other JetBrains IDEs, which run the same two build tools.

  • A Maven repository. If you have none, create one.
  • A repository token that reaches it. See Repository tokens. Your username is the email address of the account that created the token, and your password is the token.
  • Your repository’s URL, https://<organization>.mycloudrepo.io/repositories/<repository>.

1. Put the credential in ~/.m2/settings.xml. The <id> is a name you choose, and the repository in your pom.xml must use the same one. ${env.CLOUDREPO_TOKEN} reads the token from an environment variable, so the file holds no token.

~/.m2/settings.xml
<settings>
<servers>
<server>
<id>cloudrepo</id>
<username>you@example.com</username>
<password>${env.CLOUDREPO_TOKEN}</password>
</server>
</servers>
</settings>

2. Name the repository in your pom.xml, to resolve dependencies from it and to publish to it. Pages for both: Pull Maven artifacts and Publish Maven artifacts.

3. Tell the IDE which settings file to read. Open Settings | Build, Execution, Deployment | Build Tools | Maven and check the user settings file the IDE uses. It must be the settings.xml above.

4. Give the IDE the token. The IDE runs Maven in its own environment, and ${env.CLOUDREPO_TOKEN} is read from there. A program sees the environment variables of the process that started it, so an IDE started from a launcher does not see a variable you exported in a terminal. Either start the IDE from the shell that exports the variable, or set it for the IDE’s Maven runs under Maven | Runner | Environment variables.

Run a build that needs CloudRepo from the IDE’s Maven or Gradle tool window: resolve a dependency from your repository, or run deploy (Maven) or publish (Gradle) to publish. If the same build works in a terminal and fails in the IDE, the IDE is not reading the file or the variable you set up above: check the settings named on this page, and that you restarted the IDE after changing an environment variable.

If the build fails with a status, the cause is the one the build tool’s page lists, and it is the same in the IDE. See “When Maven answers 401, 403 or 404” on Pull Maven artifacts, “When Gradle answers 401, 403 or 404” on Pull Gradle dependencies, and the matching list on each publish page.

CloudRepo serves *.mycloudrepo.io with a publicly trusted certificate, so neither the IDE nor its JDK needs a certificate imported to trust it. If your network terminates TLS at a corporate proxy, the certificate the IDE sees is the proxy’s, and the proxy’s certificate authority must be trusted by the JDK the IDE runs on. See JetBrains’ documentation for the IDE’s certificate settings.

More: Repository tokens, for every client’s credential; Proxy repositories, to resolve Maven Central through CloudRepo; and the JetBrains documentation for Maven and for Gradle.