2

How to create Spring Boot project without using Maven?

Or is there any option to work with Maven in offline mode? I am asking because in office I am not authorized to download any file (due to corporate proxy) and Maven is not downloading jars even I have set proxy in settings.xml.

halfer
  • 19,824
  • 17
  • 99
  • 186
Faizan Mubasher
  • 4,427
  • 11
  • 45
  • 81
  • The usual setup for such a scenario is a company wide (or maybe team wide) repository manager - such as Nexus or Artifactory - and a Maven configuration which connects to that repository manager. That repository manager then must still have access to the internet because it must still download artifacts from there (but you can configure that internet access at a central point). – Seelenvirtuose Jun 21 '18 at 11:14
  • You are right but there is no such thing here that's why I am asking. I do have internet access. Jar files are downloaded from web browser but they can't be downloaded from Maven, maven doesn't download jar files. Just for your reference: https://stackoverflow.com/questions/50943317/maven-not-downloading-jars-behind-proxy – Faizan Mubasher Jun 21 '18 at 11:17
  • 1
    If you've got the JARs then you can copy them to the local maven repository and then maven will have no need to go off and download them. Rather than copying and creating the folder structures manually you can do as detailed here: https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html. – Alan Hay Jun 21 '18 at 11:22
  • @AlanHay Your comment is appealing. – Faizan Mubasher Jun 21 '18 at 11:27
  • A project referencing spring-boot-starter has a dependency on a further 20+ Jars however. This is no way to be developing. – Alan Hay Jun 21 '18 at 11:29
  • @FaizanMubasher "but there is no such thing here" => Then install one yourself! We did the same ... – Seelenvirtuose Jun 21 '18 at 13:28
  • If you really like to develop things with Spring Boot I can simply say. A repository manager is required not optional...things like installing manually via `maven-install-plugin:install-file` will be practically impossible... – khmarbaise Jun 21 '18 at 17:25

3 Answers3

0

You need to get the jars to compile / build your project. If you are not using maven then, you can use any other tool (may be gradle), but the point is to how you can get the actual jars,if those are blocked on network level. Suggestions would be

  1. Talk to IT team and ask them to unblock maven repository urls. (recommended).
  2. Setup local repository, and point you maven file to that repo. (it has limitation, as you need to update this folder for any new dependencies (cumbersome task). Its not worth to copy all those jars in your local repo and maintain its version, unless you are working on some critical / gov project, where they absolutely not ready to allow maven urls.
Sangam Belose
  • 4,262
  • 8
  • 26
  • 48
0

I can relate so much with your struggle, I've been in that situation quite a few times.

Usually, the issue is that some IDE come with Maven embedded, meaning that you need to make sure to modify the right Maven file. Though, from what I've seen, STS doesn't seem to have that.

Jar files are downloaded from web browser but they can't be downloaded from Maven, maven doesn't download jar files

The fact that you can manually download the jars from your browser is proof that it's most likely a configuration issue.

Assuming you're in an IT company, ask somebody where they downloaded their IDE/tools. You should be able to find a pre-configured Maven install with all company repositories already in the settings.xml file.

If you can't, then ask if you can see their Maven's settings.xml file -- but you should probably ask them to hide their password before.

TwiN
  • 3,554
  • 1
  • 20
  • 31
0

you can download the jar manually then install it to your maven local repo using this command:

mvn install:install-file -Dfile=<path-to-file> -DgroupId=<group-id> 
-DartifactId=<artifact-id> -Dversion=<version> -Dpackaging=<packaging>
GITOS
  • 13
  • 7