[JAVA] Use Maven only for downloading dependent libraries

Well, omitting the front talk, the procedure to download a set of libraries in the Maven repository on Windows, including dependencies.

    1. Bring OpenJDK and deploy it. https://jdk.java.net/13/ Download and unzip the zip file. Copy the jdk-13 folder to C: \ and rename it to "C: \ jdk".
  1. Bring and deploy Apache Maven. https://maven.apache.org/download.cgi Download and unzip the zip file. Copy the apache-maven-x.x.x folder to C: \ and rename it to "C: \ maven".

    1. Start a command prompt and go to maven bin.

\maven\bin



 4. Set JAVA_HOME.

#### **`\jdk`**
```> set java_home=c


 5. Create pom.xml.
 Copy and paste the snippets available in the Maven repository at "Copy and paste the library you want to download from the Maven repository here".
 An example is Spring Data Core 2.1.11.
https://mvnrepository.com/artifact/org.springframework.data/spring-data-commons/2.1.11.RELEASE


#### **`> notepad pom.xml`**
```xml



#### **`pom.xml`**
```xml

<project>
<modelVersion>4.0.0</modelVersion>
<groupId>id</groupId>
<artifactId>dl</artifactId>
<version>1</version>

<dependencies>
<!--Copy and paste the library you want to download from the Maven repository here-->

<!-- https://mvnrepository.com/artifact/org.springframework.data/spring-data-commons -->
<dependency>
    <groupId>org.springframework.data</groupId>
    <artifactId>spring-data-commons</artifactId>
    <version>2.1.11.RELEASE</version>
</dependency>

</dependencies>
</project>

  1. Run mvn.

copy-dependencies



 7. A set of libraries will be downloaded to ". \ Target \ dependency" including dependencies, so copy it to the lib directory of the application.

C:\maven\bin>dir .\target\dependency The volume label on drive C is Windows Volume serial number is 9281-A910

C:\maven\bin\target\dependency directory

2019/10/06 00:46

. 2019/10/06 00:46 .. 2019/10/06 00:46 41,139 slf4j-api-1.7.26.jar 2019/10/06 00:46 673,979 spring-beans-5.1.10.RELEASE.jar 2019/10/06 00:46 1,301,116 spring-core-5.1.10.RELEASE.jar 2019/10/06 00:46 1,176,955 spring-data-commons-2.1.11.RELEASE.jar 2019/10/06 00:46 23,764 spring-jcl-5.1.10.RELEASE.jar 5 files 3,216,953 bytes 2 directories 80,748,457,984 bytes of free space


 that's all.


Recommended Posts