Skip to content

Commit aaf08bf

Browse files
Create page for custom repository setup
1 parent 4551242 commit aaf08bf

File tree

3 files changed

+95
-0
lines changed

3 files changed

+95
-0
lines changed
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
---
2+
title: "Custom Repositories"
3+
url: /refguide/managed-dependencies/custom-repositories
4+
weight: 2
5+
description: "Describes how to setup a custom repository locally"
6+
---
7+
8+
# Introduction
9+
10+
This document will guide you on how you can setup a custom repository like JFrog locally and configure Studio Pro to use it to resolve the Mendix project dependencies. We'll also cover how to use a simple flat file folder to store your `.jar` files. This will allow you to manage your project's dependencies more efficiently, especially for internal libraries or when internet access is limited.
11+
12+
## 1. Understanding Custom Repositories
13+
14+
Think of a custom repository as your own personal library for software components (like `.jar` files). Instead of downloading everything from the public internet (like Maven Central), you can store frequently used or private components in your own repository. This can make your builds faster and more reliable.
15+
16+
* **JFrog Artifactory** and **Sonatype Nexus** are popular tools that act as these "personal libraries." They can store your own libraries, and also "proxy" public repositories, meaning they download from the internet once and then serve it to everyone in your team from their local cache.
17+
* **Flat Directory:** This is the simplest option. You just put your `.jar` files into a regular folder on your computer and Studio Pro can read them directly from there.
18+
19+
## 2. Using custom repositories with Studio Pro
20+
21+
### 2.1 Setting up to a Remote repository
22+
23+
In this example, we have made use of JFrog. You can opt for any tool of your choice. Most of the repositories in the market have very similar capabilities.
24+
25+
#### Installing JFrog
26+
27+
Follow the installation steps from the [official documentation page](https://jfrog.com/help/r/jfrog-installation-setup-documentation/installation-steps) of JFrog to install it on your local system. If you don't have permissions to install software on your system, you can request your IT department to create a remote instance for you and provide credentials to access it.
28+
29+
#### Important Configuration for JFrog/Nexus
30+
31+
When setting up your custom repository (JFrog), it's crucial to ensure it can access public repositories like Maven Central and Gradle Plugin Portal. If your repository doesn't have these configured as "proxy" sources, you might encounter errors when Studio Pro tries to sync the required dependencies. Following are the two public repositories you will have to configure.
32+
33+
* **Maven Central URL:** `https://repo1.maven.org/maven2/`
34+
* **Gradle Plugins Repository URL:** `https://plugins.gradle.org/m2/`
35+
36+
{{< figure src="/attachments/refguide/java-programming/managed-dependencies/jfrog-remote-repositories.png" class="no-border" >}}
37+
38+
### 2.2 Setting up a directory with required dependencies
39+
40+
For some scenarios, you may want to keep your setup simple and minimal. For such cases, you can create folders on your system and store the dependencies in it.
41+
42+
We make use of the CycloneDx Gradle Plugin to generate the `vendorlib-sbom.json` file. You will have to create a `m2` (Maven) style directory which will contain this plugin. You can download it from the [Mendix GitHub repo](broken-link)
43+
44+
For the project level dependencies, you can simply place them in the directory and point Studio Pro to it.
45+
46+
Insert image - folder containing cycloneDx
47+
Insert image - flat dir
48+
49+
### 2.3 Configuring Studio Pro to use the custom repository
50+
51+
Now that your local repository is set up, you need to tell Studio Pro where to find these dependencies.
52+
53+
- Go to `Edit -> Preferences -> Deployment -> Use custom repository`. Enable this option.
54+
- Input the following settings into the text area field that will appear once your enable the above option
55+
```gradle
56+
// Use this configuration to configure Studio Pro to fetch dependencies from an artifactory.
57+
58+
maven {
59+
url = uri("http://localhost:8046/artifactory/maven-remote/") // Make sure to use the correct url to your repository
60+
// If the repository requires authentication, then uncomment the following config
61+
// credentials {
62+
// username = 'username'
63+
// password = 'password'
64+
//}
65+
}
66+
67+
// This is for the CycloneDx Gradle plugin
68+
maven {
69+
url = uri("http://localhost:8046/artifactory/gradle-remote/") // Make sure to use the correct url to your repository
70+
// If the repository requires authentication, then uncomment the following config
71+
// credentials {
72+
// username = 'username'
73+
// password = 'password'
74+
//}
75+
}
76+
```
77+
```
78+
// Use this configuration if you dont prefer using a remote repository.
79+
80+
flatDir {
81+
dirs '../libs' // This is the path to the project level dependencies. It is recommended to use absolute paths. But relative path can also be used.
82+
}
83+
84+
// This is for the CycloneDx Gradle plugin
85+
maven {
86+
url = uri("C:/Users/user/Documents/gradle-remote") // Replace with your local m2 repo path
87+
}
88+
```
89+
90+
- Press Ok and Studio Pro will start syncing the dependencies for the project.
91+
- If everything goes well, you'll be able to see your `vendorlib` directory populated with the required project dependencies and `vendorlib-sbom.json` file.
92+
- Then you can run the app to verify if it works.
93+
94+
## Troubleshooting
95+
343 KB
Loading

0 commit comments

Comments
 (0)