Use CloudRepo from Visual Studio Code
Visual Studio Code is an editor. Its Maven and Gradle extensions, and its integrated terminal, run the same build tools you run yourself, so there is no CloudRepo setting in VS Code. Set up the build tool, then check that the extension reads that setup.
Before you start
Section titled “Before you start”- A repository that holds your format, and 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. npm takes the token alone.
- Your repository’s URL,
https://<organization>.mycloudrepo.io/repositories/<repository>.
Maven and Gradle
Section titled “Maven and Gradle”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.
<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. Check what the extension reads. The Maven for Java extension reads ~/.m2/settings.xml unless its
maven.settingsFile setting names another file. If your settings.xml is somewhere else, set
maven.settingsFile to its absolute path.
4. Give the extension the token. ${env.CLOUDREPO_TOKEN} is read from the environment Maven runs in.
A program sees the environment variables of the process that started it, so an editor started from a
launcher does not see a variable you exported in a terminal. Either start VS Code from the shell that
exports the variable, or set the variable for the extension’s Maven runs in the maven.terminal.customEnv
setting, a list of names and values that the extension adds before it runs Maven.
1. Keep the credential in ~/.gradle/gradle.properties, outside your project, so it is never
committed. The username is your email address, and the password is the token.
cloudrepoUsername=you@example.comcloudrepoToken=YOUR_REPOSITORY_TOKEN2. Read it in your build script, to resolve dependencies from CloudRepo and to publish to it. Pages for both: Pull Gradle dependencies and Publish Gradle artifacts.
3. Use the Gradle for Java extension or the terminal. VS Code runs Gradle Java projects, other than
Android, through the Gradle for Java extension. Gradle reads gradle.properties from its user home,
~/.gradle unless the environment variable GRADLE_USER_HOME says otherwise, so the file above is read
by a Gradle run from the extension or from a terminal alike, as long as both use that user home.
npm, Python and Docker
Section titled “npm, Python and Docker”Run these tools in VS Code’s integrated terminal, or from your tasks, exactly as on the page for your
client. They read their own configuration files: ~/.npmrc, ~/.pypirc and pip.conf, and Docker’s
login. VS Code adds no CloudRepo setting to any of them.
- npm: Pull npm packages and Publish npm packages.
- Python: Pull Python packages and Publish Python packages.
- Docker: Pull Docker images and Push Docker images.
When the editor and your shell disagree
Section titled “When the editor and your shell disagree”If a build works in your terminal and fails from the editor, the editor is not reading the file or the variable you set up. Check the settings named above, and that you restarted VS Code after changing an environment variable. If the build fails with a status, the cause is the one on the build tool’s own page, and it is the same in the editor: see “When Maven answers 401, 403 or 404” on Pull Maven artifacts, the matching list on Pull Gradle dependencies, and the list at the end of each publish page.
CloudRepo serves *.mycloudrepo.io with a publicly trusted certificate, so a TLS error means something on
your network is replacing it, such as a corporate proxy that terminates TLS: the JDK that runs your build
must trust that proxy’s certificate authority.
More: Repository tokens, for every client’s credential; Proxy repositories, to resolve Maven Central through CloudRepo; and the Maven for Java extension’s documentation.