• Stars
    star
    162
  • Rank 232,284 (Top 5 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created about 6 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Maven Plugin used to download all Dependencies and Plugins required in a Maven build, so the build can be run without an internet connection afterwards.

Go Offline Maven Plugin

License Maven Central

Maven Plugin used to download all Dependencies and Plugins required in a Maven build, so the build can be run without an internet connection afterwards.

This is especially relevant for modern CI-Systems like Gitlab and Circle-CI which need a consistent local Maven repository in their cache to build efficiently.

The plugin can also be used to download all source files of all transitive dependencies of a project.

Maven already has an official way to do all this: the maven-dependency-plugin go-offline goal;
Unfortunately, the go-offline goal suffers from several drawbacks:

  • Multi-Module builds are not supported since the plugin tries to download reactor-dependencies from the remote repository
  • Most parameters simply do not work
  • There is no option to download dynamic dependencies

The Go Offline Maven Plugin fixes these drawbacks.

Requirements

  • Java 1.7 or higher
  • Maven 3.1.x or higher

Warning: Maven 3.5.2 has a Bug that causes the Plugin to hang. If you experience hangups during downloading dependencies, please upgrade to Maven 3.5.3 or higher (See MNG-6323 )

Warning: Maven versions 3.2.x and 3.3.x have a bug that can cause the plugin to fail if maven is started in parallel build mode (-T option). Please call the go-offline-maven-plugin without the -T option or upgrade Maven to a newer version. (See MNG-6170)

Goals

The Go Offline Maven Plugin only has one goal: "resolve-dependencies". This goal downloads all external dependencies and plugins needed for your build to your local repository. Dependencies that are built inside the reactor build of your project are excluded. For downloading, the repositories specified in your pom.xml are used.

Usage

Simply add the plugin to the pom.xml of your project. Use the root reactor pom in case of a multi module project. Make sure to configure any dynamic dependency your project has (see below).

<plugin>
    <groupId>de.qaware.maven</groupId>
    <artifactId>go-offline-maven-plugin</artifactId>
    <version>1.2.8</version>
    <configuration>
        <dynamicDependencies>
            <DynamicDependency>
                <groupId>org.apache.maven.surefire</groupId>
                <artifactId>surefire-junit4</artifactId>
                <version>2.20.1</version>
                <repositoryType>PLUGIN</repositoryType>
            </DynamicDependency>
            <DynamicDependency>
                <groupId>com.querydsl</groupId>
                <artifactId>querydsl-apt</artifactId>
                <version>4.2.1</version>
                <classifier>jpa</classifier>
                <repositoryType>MAIN</repositoryType>
            </DynamicDependency>
            <DynamicDependency>
                <groupId>org.flywaydb</groupId>
                <artifactId>flyway-commandline</artifactId>
                <version>4.0.3</version>
                <type>zip</type>
                <repositoryType>MAIN</repositoryType>
            </DynamicDependency>
        </dynamicDependencies>
    </configuration>
</plugin>

To download all dependencies to your local repository, use

mvn de.qaware.maven:go-offline-maven-plugin:resolve-dependencies

Make sure to activate any profiles etc. so that all relevant modules of your project are included in the Maven run.

Dynamic Dependencies

Unfortunately some Maven Plugins dynamically load additional dependencies when they are run. Since those dependencies are not necessarily specified anywhere in the plugins pom.xml, the Go Offline Maven Plugin cannot know that it has to download those dependencies. Most prominently, the surefire-maven-plugin dynamically loads test-providers based on the tests it finds in the project.

You must tell the Go Offline Maven Plugin of those dynamic depenencies to ensure all dependencies are downloaded. For each dependency, add a DynamicDependency block to the plugin's configuration as seen in the Usage section. Each dynamic dependency block consists of the following parameters:

  • groupId The GroupId of the dynamic dependency to download
  • artifactId The ArtifactId of the dynamic dependency to download
  • version The version of the dynamic dependency to download
  • classifier (optional) The classifier of the dynamic dependency to download
  • type (optional) The type of the dynamic dependency to download
  • repositoryType Either 'MAIN' or 'PLUGIN' to control from which repository the dependency is downloaded

Note that Plugins are not consistent about where they pull their dynamic dependencies from. Some use the Plugin-Repository , some the Main-Repository. If one doesn't work, try the other.

Downloading Sources and Javadoc

The plugin can also download the source files and/or javadoc of the project's transitive dependencies. This behaviour can either be activated via the pom.xml or a command line parameter.

<plugin>
    <groupId>de.qaware.maven</groupId>
    <artifactId>go-offline-maven-plugin</artifactId>
    <version>1.2.8</version>
    <configuration>
       <downloadSources>true</downloadSources>
       <downloadJavadoc>true</downloadJavadoc>
    </configuration>
</plugin>          

or

mvn de.qaware.maven:go-offline-maven-plugin:resolve-dependencies -DdownloadSources -DdownloadJavadoc

Usage in CI environments

The Go Offline Maven Plugin can be used to build a clean repository for build server environments. The resulting repository includes exactly the dependencies and plugins needed for building the project.

Gitlab

For gitlab, add the following build step to the front of your pipeline:

download-dependencies:
  image: maven:3-jdk-8
  stage: prepare
  script:
    - 'mvn de.qaware.maven:go-offline-maven-plugin:1.2.8:resolve-dependencies -Dmaven.repo.local=.m2/repository'
  cache:
    key: M2_REPO
    paths:
      - .m2/repository

This will fill the cache "M2_REPO" with all needed artifacts, reusing the previous "M2_REPO" cache to avoid downloading all artifacts on each run.

Build steps using the repository may then be configured like this:

.build
  image: maven:3-jdk-8
  stage: build
  script:
    - 'mvn install -Dmaven.repo.local=.m2/repository'
  cache:
    key: M2_REPO
    paths:
      - .m2/repository
    policy: pull

This will pull the previously filled cache into the build image and use it as the local maven repository. Policy: pull ensures that artifacts that are generated as part of the build are not written back to the cache .

License

Apache 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt)

More Repositories

1

protocurl

protoCURL is cURL for Protobuf: The command-line tool for interacting with Protobuf over HTTP REST endpoints using human-readable text formats
Go
223
star
2

openapi-generator-for-spring

Open API v3 Generator for Spring Boot applications
Java
74
star
3

cloudcomputing

Vorlesung Cloud Computing
JavaScript
64
star
4

collection-cacheable-for-spring

Spring cache extension for putting a whole collection of entities as single cache items
Java
60
star
5

big-data-landscape

Big Data Landscape (by www.qaware.de)
52
star
6

heimdall

Secure Password Storage
Java
37
star
7

dev-tool-kit

Go
37
star
8

hitchhikers-guide-cloudnative

A Hitchhiker's Guide to the Cloud Native Stack
Java
31
star
9

gradle-cloud-deployer

Gradle plugin to deploy applications to Kubernetes and DC/OS Marathon
Java
25
star
10

cloudnativestack

Open Source Components for building a Cloud Native Stack (by www.qaware.de)
24
star
11

kubepad

A cluster remote control using a Novation launchpad MIDI controller
Kotlin
23
star
12

cloud-native-zwitscher

The Cloud Native Zwitscher Showcase
Java
19
star
13

x-forwarded-filter

x-forwared filter for the masses
Java
18
star
14

sonarqube-build-breaker

Breaks the build if the quality gate of the project is red
Java
15
star
15

cloud-observability-grafana-spring-boot

Cloud observability minikube demo with Grafana and Spring Boot
Java
14
star
16

awesome-methods

A curated list of awesome software engineering and management methods
11
star
17

cloud-computing-th-rosenheim

JavaScript
11
star
18

xsd2java-gradle-plugin

The XSD2Java Gradle Plugin generates java classes from an existing XSD schema.
Groovy
10
star
19

minikube-support

The minikube support tools provides a better integration into your local operating system.
Go
10
star
20

mysql-benchmark-tool

MySQL Benchmark Tool
Java
9
star
21

cloud-native-explab

QAware Cloud Native Experience Lab
HCL
7
star
22

qaware-blog-source

Dockerfile
7
star
23

cloudid-showcase

Cloud Native Identity Management Showcase.
Java
7
star
24

findfacts

Project to make isabelle and the AFP easily searchable.
Scala
7
star
25

majx

Matching JSON expressively
Java
6
star
26

test-shard-maven-plugin

The test shard maven plugin is a maven plugin to split tests into shards. The main aim is to use these shards for concurrent testing.
Java
5
star
27

jcon22-spring-boot-caching

Demo project for the JCON22 Talk "Caching mit Spring Boot: Pain & Gain"
Java
4
star
28

centos7-jdk8

A CentOS7 docker container with JDK8 installed.
3
star
29

dynacity

Software City for visualizing traces
C#
3
star
30

mesos-codefest

Codefest: DCOS with Mesos and Marathon
Shell
3
star
31

iot-hessen-amazon-echo

SourceCode for the talk at IoT Hessen 2017: Amazon Echo
Java
3
star
32

code-design-2018

Code for the Code+Design workshop 2018
HTML
3
star
33

cloud-native-weather-javaee

A simple weather REST service using Payara Micro, JavaEE and Microprofile APIs.
Java
2
star
34

cloud-native-landscape

Cloud Native Landscape (by www.qaware.de)
2
star
35

cloudcontrol

A cluster orchestrator remote control using a Novation Launch Control MIDI controller
Kotlin
2
star
36

distroless-zulu-payara-micro

Custom Docker images that combines Google Distroless Base Image + Zulu OpenJDK + Payara Micro.
Dockerfile
2
star
37

rust-hands-on

Rust hands-on Codefest Skript und Code.
Rust
2
star
38

alpine-k8s-openjdk8

Kubernetes compatible Alpine linux image with OpenJDK8, DNS and Bash.
Shell
2
star
39

golang-merit-money

Go
1
star
40

building-iot-2017

Source code for the Amazon Echo talk at buildingIoT 2017
Java
1
star
41

zulu-alpine-payara-micro

Custom Docker images that combine Zulu OpenJDK on Alpine with Payara Micro.
Dockerfile
1
star
42

cloud-computing-th-rosenheim-observability

Observability Stack with Loki, Grafana, Mimir and Tempo
HTML
1
star
43

cloud-native-weather-nodejs

A simple weather REST service using Node.js
JavaScript
1
star
44

cloud-native-weather-golang

A simple weather REST service using Golang, Gin and GORM.
Go
1
star
45

findfacts-deployment

Shell
1
star
46

cloud-native-weather-vue3

This example implements a simple UI for the weather service using Vue3.
Vue
1
star
47

debian8-jdk8

A Debian 8 docker container with JDK8 installed.
1
star
48

charts

Public QAware Helm chart repository
Smarty
1
star
49

cloud-native-weather-dotnet

A simple weather REST service using .Net Core.
C#
1
star
50

binary-data-format-comparison

Comparison of different binary data formats
Java
1
star
51

emergen

An emergent design generator framework based on Java APT.
Java
1
star
52

readability-analysis-tool

Readability Analysis Tool (RAT) Open Source Project.
HTML
1
star
53

cloud-native-weather-spring

A simple weather REST service using the Spring Framework.
Java
1
star
54

cloud-cost-fitness

Library for Cloud Cost Architecture Fitness Functions
Java
1
star
55

scale-react-neutral

Native React reimplementation of Telekom Scale Framework
TypeScript
1
star
56

debian8-jre8

A Debian 8 docker container with JRE8 installed.
1
star
57

centos7-jre8

A CentOS7 docker container with JRE8 installed.
1
star
58

microservices-with-micronaut

Code for the talk "Microservices with Micronaut"
Java
1
star
59

spring-boot-testing-demo

Demo for showcasing Testing with Spring Boot
Java
1
star
60

mlops-demo

This repository showcases the MLOps use case of fast and efficient incorporation of production data.
Python
1
star