Can I download the whole .m2 folder from the internet in place of downloading single jar file?
-
1What do you mean `download the whole .m2 folder` ? Its a local folder on your machine created by maven. – Saif Asif Apr 18 '14 at 06:25
-
Maven will download the JARs as it needs them; the .m2/repository is (mainly) a cache… – Donal Fellows Apr 18 '14 at 06:33
-
In my .m2 folder there are missing jar files of springframework in order to download single single jar files of this can i download all the jar files of springframework? – chetna agarwal Apr 18 '14 at 11:39
4 Answers
Remember...
Over the classical way (put a dependency inside a pom and delegate to maven the download)
You have two way to copy a jar into m2
1: The "manual one" just download the jar an put inside the file inside .m2 under the correct path..
2: The official one----> http://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html

- 1,307
- 2
- 19
- 39
-
after applying "2" way I am getting this [ERROR] Failed to execute goal org.apache.maven.plugins:maven-install-plugin:2.4:install-file (default-cli) on project search-api: Error installing artifact 'com.bestbuy.search.api:search-api:war': Failed to install artifact com.bestbuy.search.a pi:search-api:war:14.14-SNAPSHOT: D:\ProgramFiles\workspace\BestBuy\Bestbuy\search-api (Access is denied) -> [Help 1] – chetna agarwal Apr 18 '14 at 11:40
-
Yhea...But that jar is your, is not a thir part jar...right? If so...you have to make your own install (mvn install)... My instruction was for the installation of third part jar...let me know if you uderstandn what i'm saying... – ivoruJavaBoy Apr 18 '14 at 12:45
-
-
sorry your answer was right for jar files but not what i wanted? – chetna agarwal Apr 22 '14 at 04:51
-
What i wanted was is there any way of downloading all the jar files in .m2 folder at once rather than downloading them one by one. for ex: If i have 50 jar files missing of spring then in place of downloading all 50 jar files one by one, can i download all of them at once. – chetna agarwal Apr 28 '14 at 07:56
-
And no need to be sorry Your answer was right according to the question which was asked. – chetna agarwal Apr 28 '14 at 07:58
I'm not understanding ...
If I've to make Spring application ...
I put all the dependencies inside my pom.xml .... like this:
<?xml version="1.0" encoding="UTF-8"?>
<!-- A project with Spring MVC, JPA and Hibernate SessionFactory -->
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>MavenWeb</groupId>
<artifactId>MavenWeb</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<description></description>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.12.1.GA</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>3.6.3.Final</version>
</dependency>
<!-- dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId>
<version>1.4.2</version> </dependency -->
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.10</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>20030825.184428</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>20030825.183949</version>
</dependency>
</dependencies>
<properties>
<org.springframework.version>3.0.2.RELEASE</org.springframework.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.0.1</version>
</plugin>
</plugins>
</build>
</project>
When I run the Maven install, maven downloads from the remote central repository to the jar it needs to run the application...
in this way you've downloaded all the jars you need inside your .m2 folder...
That's the usual use of Maven dependencies management ....
but if it's does not help you, maybe I'm not understanding your problem...

- 1,307
- 2
- 19
- 39
If jars are missing which you placed in pom.xml and you want to download, then Right click on your project and run as "Maven Install" it will download the missing jars.

- 239
- 2
- 13
Maybe the actual JAR file you are looking for is not provided in the release, but the POM file is. In that case, until you explicitly tell Maven to use the BOM file to import the needed library, the former will only set up a correct folder hierarchy in your .m2 repository, but with nothing interesting in it.
See the official documentation for the correct lines of code to do so. Here is an example dealing with the org.codehaus.groovy:groovy-all:2.5.9
library (see the top-right item for the Apache Maven lines of code).

- 303
- 3
- 14
-
See [this answer](https://stackoverflow.com/a/55207956/7009806) for some more insight on this topic. – Olivier Mar 06 '20 at 08:42