All Projects → timboudreau → tiny-maven-proxy

timboudreau / tiny-maven-proxy

Licence: other
A tiny maven proxy

Programming Languages

java
68154 projects - #9 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to tiny-maven-proxy

maven-archetypes-catalog-plugin
A plugin to enable IntelliJ IDEA to fetch external Maven Archetype Catalog files
Stars: ✭ 19 (-68.85%)
Mutual labels:  maven
mcs
Search the Maven Central Repository from your command line!
Stars: ✭ 61 (+0%)
Mutual labels:  maven
spring-boot2-jpa-crud-example
spring boot2 jpa crud REST APIs example
Stars: ✭ 37 (-39.34%)
Mutual labels:  maven
mvnsh
Maven Shell
Stars: ✭ 50 (-18.03%)
Mutual labels:  maven
betca-spring
BETCA (Spring). Back-end con Tecnologías de Código Abierto, versión Java-Spring
Stars: ✭ 27 (-55.74%)
Mutual labels:  maven
twjitm-core
采用Netty信息加载实现长连接实时通讯系统,客户端可以值任何场景,支持实时http通讯、webSocket通讯、tcp协议通讯、和udp协议通讯、广播协议等 通过http协议,rpc协议。 采用自定义网络数据包结构, 实现自定义网络栈。
Stars: ✭ 98 (+60.66%)
Mutual labels:  maven
monorepo
Structure and workflows of our internal git-maven-monorepo
Stars: ✭ 16 (-73.77%)
Mutual labels:  maven
ssm-ishop
项目描述:iShop商店实现浏览商品、下订单,以及参加各种活动和后台管理功能。 技术描述: 1.通过maven来项目构建管理,子系统之间通过服务提供者模块与服务接收者模块相互交互,来实现系统之间的通信,利用ajax异步请求json数据,也利用jsonp跨域请求获取json资源数据。 2.后台技术实现: 利用MyBatis Generator自动生成单表的CRUD功能和对应的model、example、mapper、service代码;3运用分布式数据库redis实现系统大量不实时更新的数据做缓存,同时实现session在redis上共享,使用powerdesinger创建pdm/cdm关系的数据库表,依文档在linux上搭建mysql创建相应的数据库和表。运用springmvc提供的注…
Stars: ✭ 28 (-54.1%)
Mutual labels:  maven
billy
An opensource invoicing engine --
Stars: ✭ 28 (-54.1%)
Mutual labels:  maven
javaparser-maven-sample
Sample project with a basic Maven + JavaParser setup
Stars: ✭ 56 (-8.2%)
Mutual labels:  maven
VickyWarAnalyzer
Victoria II war analyzer. Java 8 + JavaFX + Maven
Stars: ✭ 43 (-29.51%)
Mutual labels:  maven
maven-sources
Apache Maven Sources
Stars: ✭ 59 (-3.28%)
Mutual labels:  maven
carnotzet
Modular and Re-usable Docker Environments using Maven
Stars: ✭ 44 (-27.87%)
Mutual labels:  maven
bintray-upload-plugin
📦 Insanely easy way to upload your Android Library to Bintray/JCenter
Stars: ✭ 18 (-70.49%)
Mutual labels:  maven
RgxGen
Regex: generate matching and non matching strings based on regex pattern.
Stars: ✭ 45 (-26.23%)
Mutual labels:  maven
native-build-tools
Native-image plugins for various build tools
Stars: ✭ 168 (+175.41%)
Mutual labels:  maven
database-all
Eloquent ORM for Java 【database-spring-boot-starter】
Stars: ✭ 151 (+147.54%)
Mutual labels:  maven
LogoRRR
A log viewer which visualises log events such that it is easy to identify problems or events of interest. This app was implemented using Scala and JavaFX, GluonHQ toolchain and GraalVM as platform.
Stars: ✭ 40 (-34.43%)
Mutual labels:  maven
spring-batch
Spring Batch Tutorials
Stars: ✭ 23 (-62.3%)
Mutual labels:  maven
coc-groovy
Groovy language extension for coc.nvim
Stars: ✭ 14 (-77.05%)
Mutual labels:  maven

Tiny Maven Proxy

Is exactly what it says it is - a tiny proxy server for Maven, which you can run on your local network. The only thing it does (at present) is proxy stuff Maven downloads and cache it.

If you have a slow-ish internet connection, and you have multiple machines or a team that will all be building and downloading, this is the project for you.

It is a tiny server you can run with java -jar somewhere on your network, and configure Maven to use. It is written with acteur and Netty, meaning that it is asynchronous, with a small memory footprint and low memory usage (microscopic if you're used to Java EE - -Xmx16M is reasonable).

By default it runs on port 5956. It has a minimal web-ui.

You give it a list of repository URLs to proxy, and a folder to cache files in, and run it. Then configure your ~/.m2/settings.xml to use it. That's all.

Download a recent build here

Screenshot

Configuration

There are two properties you'll want to set. You can either set them from the command-line, or in a tiny-maven-proxy.properties file that can live in /etc, /opt/local/etc, /~ or ./ (these override each other in that order).

Example

java -jar tiny-maven-proxy.jar --maven.dir /var/lib/maven --mirror https://repo1.maven.org/maven2,http://bits.netbeans.org/maven2/

or you could create /etc/tiny-maven-proxy.properties and put in it:

maven.dir=/var/lib/maven
mirror=https://repo1.maven.org/maven2,http://bits.netbeans.org/maven2/

Other properties that affect Acteur that may be useful:

  • port - the port to run on
  • cors.enabled - whether or not to answer CORS preflight requests affirmitively - on by default
  • workerThreads - the number of threads used to answer requests (one thread can work on multiple requests at a time with netty, so 4-8 is usually enough)
  • log.file - log to a file

Defaults

If maven.dir is not set, it will create a /maven directory in the system temporary dir (on most OSs this is wiped on reboot).

The following is the list of Maven repositories it proxies by default, if you do not set the mirror setting:

* https://repo1.maven.org/maven2
* http://bits.netbeans.org/maven2/
* http://bits.netbeans.org/nexus/content/repositories/snapshots/
* https://timboudreau.com/builds/plugin/repository/everything/
* https://maven.java.net/content/groups/public/
* https://oss.sonatype.org/

What This Project Is Not

It is not a full-featured Maven proxy, such as Nexus or Artifactory. Those are great if you need to manage complex mirroring setups, authentication, etc.

It does no authentication, validation, checksum checking (but your Maven client will, so you'll get the same result as if you'd downloaded things directly).

Indexing

IDEs and other tools will try to download a Nexus-style maven index. A companion project next to this makes it simple to automate index generation. It embeds the nexus-cli tool in a single fat-jar and runs it appropriately.

Since plexus depends on a version of Guice from the dawn of time, we cannot embed the indexer directly in tiny-maven-proxy. However, it is trivial to set up as a cron job. Here is an example crontab:

@hourly /usr/bin/java -jar /opt/tiny-maven-proxy/tiny-maven-indexer.jar --repositoryId dr.timboudreau.org --repositoryDir /space/maven/repository

To build it, simply build the companion project with mvn install, copy tiny-maven-indexer.jar to wherever you need it, and set it up to run periodically as the same user tiny-maven-proxy runs as on the target server.

Logging

The project uses bunyan-java for logging in JSON format - more about bunyan-java here. That makes it easy to collect metrics and stats and process log files using the bunyan command-line utility (to get that, install NodeJS and then run nbm install -g bunyan on the command-line).

To-Dos

  • Clean out -SNAPSHOT dependencies periodically

Under The Hood

Tiny Maven Proxy uses netty-http-client for downloads, and acteur for the server piece. On a request for a non-cached file, it simultaneously attempts downloads from all the servers it knows about, and when one succeeds, cancels the others.

Command-line and configuration file management is done with giulius.

Footprint

While the default Java 64Mb heap is preferred, especially if the server will be heavily used, just to prove you can run this with a minimal memory footprint, you can run it and use it with an 7Mb heap - the following command-line sets up a JDK 8 vm appropriately:

java -XX:-UseConcMarkSweepGC -Xmx7M -jar tiny-maven-proxy.jar --log.level=fatal 
	--acteur.fork.join false --download.chunk.size 256

A bunch of care is taken to ensure as few memory copies as possible are performed, and that downloads are read and written chunk by chunk, so the whole file is never dragged into memory at once.

Hopefully this demonstrates what you can do with non-blocking I/O and a bit of care :-)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].