![Building RESTful Web Services with Spring 5(Second Edition)](https://wfqqreader-1252317822.image.myqcloud.com/cover/282/36700282/b_36700282.jpg)
上QQ阅读APP看书,第一时间看更新
Adding Log4j 2.9.1 to POM dependency
Once the dependency is added and the project is updated on your IDE, the corresponding library will be copied into \.m2\repository:
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.9.1</version>
</dependency>
The preceding dependency, log4j-core, will be added under POM. In this dependency, you can see groupId, artifactId, and version explained as follows:
- groupId is used to make the JAR/WAR file unique across all projects. As it will be used globally, Maven recommends that the package names follow the same rules as that of domain names with subgroups. A sample groupId is com.google.appengine. However, some third-party dependencies don't follow the groupId package-naming policy. Check the following sample:
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.9</version>
</dependency>
- artifactId is just the name of the JAR/WAR file without the extension.
- version comes with number to show the JAR file version. Some JAR files come with extra information, such as RELEASE, for example, 3.1.4.RELEASE.
The following code will download the spring-security-web library 3.1.4 JAR file to the repository location:
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>3.1.4.RELEASE</version>
</dependency>
The Log4j-core files (in Windows) will appear as follows:
![](https://epubservercos.yuewen.com/C1132F/19470398508911206/epubprivate/OEBPS/Images/6885c0ed-5235-46c9-84e7-90a5a307da1c.png?sign=1739293141-z7JI5u5icow7whTjLzboIiZX0tAPwcO2-0-a7cf64b9a7032e344a12ae2de636296a)
Sometimes, you may see the .jar file missing when you update the project on IDE. In such cases, delete the whole folder (in our case log4j-core folder) and update them once again. In order to update the missing JAR file, after you delete the folder, just update your IDE (STS /Eclipse in our case) by right clicking the project and select Maven | Update Project . Finally, make sure you have the .jar file available under the folder.
Sample repositories in .m2\repository should appear as follows:
![](https://epubservercos.yuewen.com/C1132F/19470398508911206/epubprivate/OEBPS/Images/daa56abc-3dd9-4bf6-9d32-7ef734d980e2.png?sign=1739293141-7XFFPe2dUrMP3d8AN0ypwUEesfRRKeR7-0-f431d94b46e18170cfd2a15cb4c3fae2)
When you update a project (in Eclipse or any other IDE), it will get the JAR and related files from a remote Maven repository to your system's central repository.