Use CloudRepo from Eclipse
Eclipse builds Maven projects with m2e and Gradle projects with Buildship, and CloudRepo is a Maven repository, so there is no CloudRepo setting in Eclipse. Set up the build tool, then check that Eclipse reads that setup.
Before you start
Section titled “Before you start”- 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>.
Set up the build tool
Section titled “Set up the build tool”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 which settings file m2e reads. m2e has a Maven preference page for the user settings file,
in Eclipse’s preferences. Check that it names the settings.xml above, and restart Eclipse if a build
still ignores the file.
4. Give Eclipse 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 Eclipse started from a
launcher does not see a variable you exported in a terminal. Start Eclipse from the shell that exports the
variable.
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. Let Buildship run Gradle. Buildship runs your Gradle build, and Gradle reads gradle.properties
from its user home, ~/.gradle unless the environment variable GRADLE_USER_HOME says otherwise. Keep the
credential there, and not in a JVM argument or in the project. If a build from Eclipse ignores the file,
check which Gradle user home Eclipse uses: see the
Buildship documentation.
Check it from Eclipse
Section titled “Check it from Eclipse”Run a build that needs CloudRepo from Eclipse: resolve a dependency from your repository, or run the
deploy (Maven) or publish (Gradle) goal to publish. If the same build works in a terminal and fails in
Eclipse, Eclipse is not reading the file or the variable you set up. If it fails with a status, the cause
is the one on the build tool’s own page, and it is the same in Eclipse: 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 m2e documentation.