0

I was wondering if it is possible to run maven in offline mode.

When I try to run maven on my PC it compiles on same sources without error. But once I migrate same project to work PC I get Build failure. After checking some error logs, problem seems to be that maven repo times out, which is highly possible due to closed ports on my laptop.

Connect to repo.maven.apache.org:443 [repo.maven.apache.org/151.101.112.215] failed: Connection timed out.

Unfortunately, I cannot do anything about ports because of restrictions places on my laptop. On the other hand port 443 should be enabled since it is one of widely used ports.

Any ideas how I could solve this issue?

PapeK24
  • 988
  • 1
  • 10
  • 26

1 Answers1

3

This might be of use: how do i configure maven for offline development

If i had to guess, I'd say that maven central is being blocked by your corp firewall. You're going to want that opened up. Alternatively, your IT group can create an inhouse nexus or artifactory (read maven repo) to get these artifacts.

Even if you run it in offline, you're going to need those dependencies. So if you can't get them on your work laptop, running maven in any mode isn't going to work.

tfecw
  • 437
  • 1
  • 6
  • 11
  • Thanks a lot this should help. Is there any way for me to download dependencies manually? Like running build on my personal laptop and copying dependencies folder? (sorry if that sounds stupid I am new to maven). – PapeK24 Oct 27 '17 at 13:41
  • 1
    There is, but it's a bit of pain that I wouldn't recommend. A large part of maven is the dependency management and you'd be doing this all manually and you'll be in jar hell. Not a good place. You also run the risk of messing up your mavenLocal (where maven downloads files locally). Make sure the group,artifiact id, and version match perfectly with the version you download. [Add a dependency in maven](https://stackoverflow.com/questions/396245/add-a-dependency-in-maven#396770) – tfecw Oct 27 '17 at 13:46
  • Well, it might be only option. My company does not develop Java and I am pretty sure that they are not gonna change their policy for me. Is there any other option for me to build .jar from about 20 source files? – PapeK24 Oct 27 '17 at 13:55
  • @PapeK24 It is entirely routine for larger companies to have a software-use policy that requires all libraries to go through a centralized corporate repository (Nexus or Artifactory, usually). The fact that Central is blocked suggests this is the case, and there's probably someone in IT or development who can explain the policy and how to access the corporate repository. – chrylis -cautiouslyoptimistic- Oct 27 '17 at 14:32