Metadata-Version: 2.4
Name: jre-mirror
Version: 0.0.9
Summary: A simple tool to deploy the jre binary releases mirror.
Project-URL: Homepage, https://github.com/odys-z/JRE-Mirror
Project-URL: Issues, https://github.com/odys-z/JRE-Mirror/issues
Author-email: Ody Z <odys.zhou@gmail.com>
License: Copyright (c) 2025 Ody Z. All rights reserved.
        
        This work is licensed under the terms of the MIT license.
        For a copy, see <https://opensource.org/licenses/MIT>.
License-File: LICENSE
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Requires-Dist: anson-py3>=0.3.8
Requires-Dist: semantics-py3>=0.4.0
Requires-Dist: typing-extensions>=4.0.0
Provides-Extra: testing
Requires-Dist: pytest; extra == 'testing'
Requires-Dist: requests; extra == 'testing'
Description-Content-Type: text/markdown


[![PyPI version](https://img.shields.io/pypi/v/jre-mirror.svg)](https://pypi.org/project/jre-mirror)
[![License](https://img.shields.io/badge/license-MIT-blue)](./LICENSE)

# About

A distribution tool of a selection of
[temurin17-binaries](https://github.com/adoptium/temurin17-binaries),
as the GWF behavior is weird while downloading jre etc., with Python scripts. 

# How To

```
    JRE-Mirror requires Python 3.9 and above.
```

The sub-folders in temurin17-binaries can be deployed as a website root path.
In the sub-folders, run the Python module, jre-mirror to download the selected
binary distributions, with proxy configured in proxy.json.

Download the JRE-Mirror-jdk17.zip from the release section. Configure the list.json,
which is the download tasks configuration, where

```
    mirroring: a list of target binaries to bo downloaded from temurin17
    resources: a list of target binaries completed, and is locally available
```

Start the jre-mirror Python module to download the mirrors.

```code
    # (Tested on Ubuntu 24.0.4)
    cd JRE-Mirror/temurin17-binaries/jdk-17.0.17+10
    python3 -m venv .env
    source .env/bin/activate # For windows: source .env/Scripts/activate
    pip install jre-mirror
    python3 -m jre_mirror
```

Now configure the resources a Nginx static site or, If you need more fine control, by
starting a feature requirement, use the [Html-service](https://github.com/odys-z/html-service)
as the web service, with which a simple Windows service can be setup as a static web site.

A sample of html-service's configuration, WEB-INF/html-service.json, can be:

```
    { "type": "io.oz.srv.WebConfig",
      "port": 1984,
      "paths": [
        {"path": "/jre-17/*", "resource": "$HOME/JRE-Mirror/temurin17-binaries/jdk-17.0.17+10"}],
      "welcomepages": [],
      "startHandler": []
    }
```

Restart the service, if you followed the steps in the README of html-service. E.g.

```
    sudo systemctl restart html-service.service
```

Try

```
    http://127.0.0.1:1984/jre-17/list.json
```

The binaries and the json file can be available online now.

## About Proxy

To configure the proxy, in list.json, specify the configuration file path:

```
    # list.json
    { ...
      "proxy": "proxy.json"
      ...
    }
```

And in proxy.json, configure the proxy string following the general proxy
format of Python:

```
   { "type": "io.oz.edge.Proxy",
     "http": "http://user:passwd@127.0.0.1:port",
     "https":"http://user:passwd@127.0.0.1:port"
   }
```

#### Note: All the *type* fields in json files are neccessary.

# Credits:

## [temurin17-binaries](https://github.com/adoptium/temurin17-binaries)
The home for releases and nightlies for all Temurin17 variants and platforms

## [OpenJDK Mirror Scripts](https://github.com/adoptium/mirror-scripts)

These scripts are run at https://ci.adoptopenjdk.net/view/git-mirrors/ and are responsible for updating the Eclipse Adoptium clones of the various OpenJDK Skara github repositories that we are interested in building.

## [jyksnw/install-jdk](https://github.com/jyksnw/install-jdk)

Python package that simplifies the process of installing OpenJDK on Windows, macOS, Linux and other supported operating systems, saving time and effort. 

### So no equivolent?
