0

I have to add some .pom files to the local .m2 repository and I am working on an offline system.

After successfully installing maven (checked with mvn -v) i tried to install the desired files using mvn install:install-file -Dfile=<Path/to/pom>.

However, this leads to a NoPluginFoundforPrefixException, because the prefix "install" is apparently unknown. Trying to download it from the central repository after execution obviously fails since the computer is not connected to the internet.

How can I get mvn install to work?

Scoch
  • 11
  • 2
  • You want to make working a missing plugin without using internet, so copy it on a another support and then copy it from that support into the proper place in your M2 local repo. – davidxxx Jul 30 '18 at 07:27
  • Thanks for the quick response, I am currently downloading the files it tried to download when I executed mvn install on another device. However, I did not find anything about the structure of the local .m2 repository. Where exactly do I have to put the files? – Scoch Jul 30 '18 at 08:11
  • Edit: or did you mean the files for the missing plugin I wanted to install in the first place? – Scoch Jul 30 '18 at 08:16

1 Answers1

0

For the first time you need to use internet, so that your local/central repository get all the plugins which required to use mvn install.

Then you can work on offline mode.

Ahamed N
  • 95
  • 3
  • 13
  • Is it not possible at all without an internet connection? I can't connect it to the internet due to security policies of the company. – Scoch Jul 30 '18 at 08:22
  • If you have the plugin, then u can move the plugin to your local repos... If you doesn't have and when you run mvn install, it will first search the plugin in your local repo, then central repo and then it goes to remote repo (maven repo). This is how it actually works – Ahamed N Jul 30 '18 at 08:25
  • I have the plugins required for install, but where exactly do I have to put them in the local repo? How is its hierarchy layed out? – Scoch Jul 30 '18 at 08:29
  • Plugins are downloaded from a remote repository and stored in the local repository. The exact final location will thus depend on the groupId of the plugins (the core plugins end up in ~/.m2/repository/org/apache/maven/plugins where ~/ stands for your home directory for example in windows server 2016 it is stored under this path C:\Users\YourUserName\.m2) – Ahamed N Jul 30 '18 at 08:50
  • Thanks! I'll give it a shot – Scoch Jul 30 '18 at 08:56
  • Unfortunatley, even after adding the requested files to home/.m2/repository, I still ended up with a build failure. Don't have a fix for this, however I told my boss that it does not make sense without being able to connect to the internet at some point – Scoch Jul 30 '18 at 11:30
  • @Scoch Post your build failure output – Ahamed N Jul 31 '18 at 04:44
  • I don't have access to the pc right now, but it was again that the prefix "install" is unknown, resulting in a NoPluginFoundforPrefixException. Before it tried to download all the files from the repo again, but couldn't so it resulted in warnings. – Scoch Jul 31 '18 at 05:53
  • okay fine. Lets try with internet and if my answer is useful for you then please vote for me – Ahamed N Jul 31 '18 at 05:54
  • It's just a real pain in the ass getting it to work without ever connecting to the internet at all, it just doesn't make sense. Btw I already voted, my reputation is just to low for it to show up – Scoch Jul 31 '18 at 06:36
  • @Scoch Why can't you request your IT team for the internet connectivity ? – Ahamed N Jul 31 '18 at 06:39
  • I'm just working here for 6 weeks, wouldn't make sense. Security policies are very strict in this company, which requires me working on an offline development system. But I already have another project where I can use my regular pc so it's fine – Scoch Jul 31 '18 at 07:25