RepreZen API Studio features a powerful Code Generation framework. You can generate service implementation scaffolds, client SDK libraries, documentation, and even custom code from your Swagger–OpenAPI and RAPID-ML API specifications.
RepreZen API Studio uses Maven to manage dependencies for code generation. A Maven build process, or a Gradle build script with Maven dependencies, allows code generation from within API Studio, from the command line or from a CI/CD automated build.
The libraries required for code generation reside in Maven repositories on the internet, primarily on the Maven Central repository at http://repo.maven.apache.org/maven2/. In order for projects to build successfully, these repositories (or the artifacts available there) need to be accessible from RepreZen API Studio.
Maven Access Strategies
There are two general strategies to ensure that these repositories are accessible from a behind a firewall:
- Internal Maven Mirror: Create an internal Maven mirror repository inside the firewall, and configure Maven to use the mirror instead of external sites; or
- Proxy Server: Configure Maven's local settings on the developer desktop to use a proxy server in order to access external repositories; and if necessary add the required Maven repositories to a whitelist so access is permitted through the firewall.
Mirroring Maven Repositories
The cleanest way to make the an external Maven repository available to developers within a firewalled environment is by configuring an internal Maven server to mirror the external repository. If your organization has an internal Maven repository manager, most likely this already mirrors Maven Central. This is the preferred solution.
The procedures for this mirroring configuration will depend on the platform you're using for your internal Maven repository. Nexus, Archiva, and Artifactory are three popular Maven repository managers, and each of these has its own configuration processes.
Once the required repository is mirrored, Maven clients only need to be configured to look for that repository on the internal mirror. If this is not part of a standard Maven configuration, an entry in the user configuration file should be created, like this:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <localRepository /> <interactiveMode /> <usePluginRegistry /> <offline /> <pluginGroups /> <servers /> <mirrors> <!-- Use ONLY ONE of the following mirror configurations: --> <!-- Redirects requests for dependencies in a *SPECIFIC* external Maven repo to the internal Maven mirror. --> <mirror> <id>internal-maven-server</id> <name>Internal Maven mirror for developers</name> <mirrorOf>reprezen-repo-releases</mirrorOf> <url>http://intranet.bigco.com/maven/mirror</url> <layout>default</layout> </mirror> <!-- OR… --> <!-- Redirects requests for dependencies in *ANY* external Maven repo to the internal Maven mirror. --> <mirror> <id>internal-maven-server</id> <name>Internal Maven mirror for developers</name> <mirrorOf>*</mirrorOf> <url>http://intranet.bigco.com/maven/mirror</url> <layout>default</layout> </mirror> </mirrors> <proxies /> <profiles /> <activeProfiles /> </settings>
You only need one of the two <mirror> elements shown to ensure that requests for RepreZen dependencies are redirected to your internal Maven repository.
- The first <mirror> element only redirects requests for dependencies in the external RepreZen repository.
- The second <mirror> element redirects requests for dependencies in any Maven repository.
See the Maven Guide to Mirror Settings for further details.
Configuring Maven's Proxy Settings
The other strategy for Maven access is to configure Maven to user an internal proxy for internet access, thus allowing it to communicate with an external Maven repository.
Determining your Proxy Settings
If you're having problems with code generation, or see error markers on your project POM.XML configuration files, it's likely that you are running API Studio behind a corporate firewall, and need to configure Maven's proxy settings for internet access.
You will need to know the host, port, and in some cases the login credentials for your internet proxy. We recommend that you coordinate with your IT support team to determine the correct proxy settings, and make sure that your use of these settings follows your organization's network security policies and guidelines.
The following links may have useful information to inspect your current proxy settings:
- What Is My Proxy at WhatIsMyProxy.com
- Advanced Proxy Check at WhatIsMyIPAddress.com
- How to Find My Proxy Server at techwalla.com
- How to Change Proxy Settings at WikiHow.com
Configuring Maven's Proxy Settings
To configure Maven for external repository access through a proxy server:
1. Locate the user settings file.
By default, this should be located in your user home directory:
Mac OSX: ~/.m2/settings.xml
2. Create the following settings.xml file...
...or, if the settings.xml file already exists, add the highlighted content:
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> <localRepository /> <interactiveMode /> <usePluginRegistry /> <offline /> <pluginGroups /> <servers /> <mirrors /> <proxies> <proxy> <id>myproxy</id> <active>true</active> <protocol>http</protocol> <host>192.168.1.100</host> <port>6666</port> <username></username> <password></password> <nonProxyHosts>localhost,127.0.0.1</nonProxyHosts> </proxy> </proxies> <profiles /> <activeProfiles /> </settings>
3. Edit the Proxy Settings
Edit the host, port, and, if your HTTP proxy requires authentication, set the username and password.
4. Open Maven Settings
Open the Maven settings page in Window > Preferences > Maven:
5. Configure the User Settings File Location
The User Settings should reference the filename and location of the settings.xml file you just edited in the previous step. If necessary, change this to use the new settings file by pressing the Browse button.
6. Click the ‘Update Settings’ button to reload the settings...
Then click OK to exit Preferences.
7. Force a Maven Update in your Project
- Right-click on your project in the Project Explorer view. From the menu, choose Maven > Update project.
- Make sure ForceUpdate of Snapshots/Releases is checked, and click OK.
Whitelisting the Maven Repository
The external Maven repository must be reachable through your proxy. In most cases, this is resolved just by configuring Maven's proxy settings as described above. But a firewall with a default-deny policy will need to have the Maven repository added to a whitelist.
In this case, you'll need to have your system administrator add repo.maven.apache.org or maven.reprezen.com to the whitelist.
Note: In this kind of environment, there are likely to be other host names that need to be whitelisted. We recommend that you contact RepreZen Support for further information, so your sysadmins can add all required host names in one batch.