Faster builds for Java developers with Maven Central mirror
Thursday, November 5, 2015
The Maven Central Repository is a key host of Java dependencies and is used by many popular build systems and dependency managers, such as Apache Maven, Gradle, Ivy, Grape and Bazel. Jason van Zyl, founder of Apache Maven, is hosting a complete mirror of the Maven Central Repository on Google Cloud Storage, meaning faster builds on Google Cloud Platform.
When you build a Maven project, Maven will check your pom.xml file for dependencies. If the dependency isn’t available locally, it needs to be pulled from an online repository. With a simple change to your settings.xml configuration file, a build system running on Cloud Platform – for example, Jenkins on Google Compute Engine or Google Cloud Shell – can now fetch your project’s dependencies from Cloud Storage, increasing the speed of your builds.
To use add the following to your ~/.m2/settings.xml file:
If you want to learn more about Maven Central and its mirror on Cloud Platform, check out the post by Jason van Zyl, founder of Apache Maven.
**Java is a registered trademark of Oracle Corporation and/or its affiliates.
- Posted by Ludovic Champenois, Google Software Engineer
When you build a Maven project, Maven will check your pom.xml file for dependencies. If the dependency isn’t available locally, it needs to be pulled from an online repository. With a simple change to your settings.xml configuration file, a build system running on Cloud Platform – for example, Jenkins on Google Compute Engine or Google Cloud Shell – can now fetch your project’s dependencies from Cloud Storage, increasing the speed of your builds.
To use add the following to your ~/.m2/settings.xml file:
Americas
<settings>
<mirrors>
<mirror>
<id>google-maven-central</id>
<name>GCS Maven Central mirror</name>
<url>https://maven-central.storage-download.googleapis.com/repos/central/data/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
</settings>
EU
<settings>
<mirrors>
<mirror>
<id>google-maven-central</id>
<name>GCS Maven Central mirror EU</name>
<url>https://maven-central-eu.storage-download.googleapis.com/repos/central/data/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
</settings>
Asia Pacific
<settings>
<mirrors>
<mirror>
<id>google-maven-central</id>
<name>GCS Maven Central mirror Asia Pacific</name>
<url>https://maven-central-asia.storage-download.googleapis.com/repos/central/data/</url>
<mirrorOf>central</mirrorOf>
</mirror>
</mirrors>
</settings>
Access the Maven Central Repository via API
Google provides API libraries to access Cloud Storage in Java, Python, Node.js and Ruby. The libraries can be used to access the Maven repository bucket. For example, the following snippet lists all the entities at the top of “maven-central” storage bucket:If you want to learn more about Maven Central and its mirror on Cloud Platform, check out the post by Jason van Zyl, founder of Apache Maven.
**Java is a registered trademark of Oracle Corporation and/or its affiliates.
- Posted by Ludovic Champenois, Google Software Engineer