Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to configure maven without internet access

Tags:

java

maven

While converting dynamic web project into maven project I'm getting this error:

"CoreException: Could not calculate build plan: 
 Plugin org.apache.maven.plugins:maven-compiler-plugin"

I can't access the internet to download any jars and plugins while converting because I'm on a restricted network with no internet access. Is there is any way to make a Maven project with no internet access?

I'm using:

Eclipse kepler
Maven 3.0.4
JDK 1.6
like image 963
Parwinder Singh Avatar asked Dec 26 '22 00:12

Parwinder Singh


2 Answers

You can manually download or some how find required artifacts.(jars) Then copy them into your local maven repository.

Now you can use

mvn clean install -o  // off-line build 

to build your project without internet.

like image 61
Ruchira Gayan Ranaweera Avatar answered Jan 05 '23 07:01

Ruchira Gayan Ranaweera


About half year ago, when I worked as an intern in a company, we also encountered with virtually the same problem as you ------ we were in the restricted network, and our computers couldn't access the internet, but we still needed to use maven to update the project dependencies. Here is our solution:

  1. Find a server that can access the internet, and also you can access the server in your restricted network.
  2. Establish a sonatype nexus server on the server you found above.
  3. The sonatype nexus serer is just a private repository in your environment. You can upload your own packages into the repository, and also the nexus server can download required packages from the central maven repository.
  4. The last thing you need to do is to change the repository address in your pom.xml to the nexus server address

Hopefully, this can help you. And if you have any questions, please feel free to ask me again.

like image 32
Kevin He Avatar answered Jan 05 '23 05:01

Kevin He