Question

I'm working in a Continuous Integration environment and part of the automated build process includes the compilation of Maven managed projects.

What I want to know is if there is a way to make the Maven build independent of the network connection.

Currently we have the all the jar's that we need installed in the repository but the problem is that Maven tries to check for plugins updates and that makes the build fail if, eventually, the connection is down.

Was it helpful?

Solution

You can either run offline with the -o switch or by adding <offline>true<offline> to your settings.xml.

It's worth pointing out though that Maven may fail the build when running offline if it decides it needs to check for dependency or plugin updates. If you set your repositories with <updatePolicy>never</updatePolicy> you can avoid this, but you'll need to force updates periodically (with -U and/or -cpu).

If you are using a repository manager, you can set your repository to be a mirror of the external repositories. This still involves a network connection, but only your internal network (or if the repository manager is on your local machine, no connection at all).

For example this config redirects all calls to central to my local Nexus server running on my development box:

<mirrors>
  <mirror>
    <id>central-proxy</id>
    <mirrorOf>central</mirrorOf>
    <url>http://localhost/nexus/content/groups/public</url>
  </mirror>
</mirrors>

OTHER TIPS

use the -o (offline) option

You can try installing a "Build Artifact Repository Manager" like Archiva (http://archiva.apache.org/) in you local network. It will work as a mirror, so maven will try to download and check for updates on your local network and not over internet. Uou should also build your own artifacts and use it on archiva.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top