Skip to content

How to Build and Use your own version

Tamás Kőhegyi edited this page Feb 9, 2024 · 3 revisions

Introduction

It may happen that none of the officially released version fits to your special purpose, and in such situation sometimes it is necessary to build your own version from the source code. Below you may read instruction on how to build your own version of the proxy.

Pre-requisite

You must have the following tools/programs installed properly:

  • git
  • jdk 11 and above (note that the latest release now uses jdk 21)

Build

#first go to a folder in which you would like to place the mitmJavaProxy code base
cd your_preferred_folder

#get the source from GitHub repository
#note that this step is necessary only one time, therefore if you have the source already, you may skip this step
git clone https://github.com/tkohegyi/mitmJavaProxy.git

#go into the main source folder
cd mitmJavaProxy

#ensure that you have all latest updates in your local repo
git pull

#now build it; during the test run phase 2 tests may be skipped, that is normal - but finally the build must be SUCCESS
./gradlew clean build 
#the compiled library will be stored in build/libs folder

#when the above compilation was successful you may publish the jar into your local maven repository in one step
./gradlew publishToMavenLocal

Identifying the local library

The version of the proxy is determined by properties defined in build.gradle file, plus a possible buildNumber parameter that can be spacified during the build in this way:

./gradlew clean build -PbuildNumber=myPersonalUniqueBuildNumber

Without specifying the buildNumber, its default value will be used, which is SNAPSHOT, resulting in a similar library name like: mitm-java-proxy-2.5.26.SNAPSHOT.jar

Using local mitmJavaProxy library

You may use your local version of the library by using this approach in your project, from where mitmJavaProxy is planned to be used:

repositories {
    mavenLocal()
}

dependencies {
    implementation('website.magyar:mitm-java-proxy:2.5.26.SNAPSHOT')
}

Have fun!