- Building RESTful Web Services with Spring 5(Second Edition)
- Raja CSP Raman Ludovic Dewailly
- 286字
- 2021-06-30 19:13:26
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:

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:

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.
推薦閱讀
- Mastering Node.js(Second Edition)
- Cisco OSPF命令與配置手冊
- Mastering Machine Learning for Penetration Testing
- EDA技術(shù)與VHDL編程
- INSTANT PhpStorm Starter
- HTML5 Game development with ImpactJS
- 網(wǎng)絡(luò)的琴弦:玩轉(zhuǎn)IP看監(jiān)控
- 物聯(lián)網(wǎng)安全技術(shù)
- 物聯(lián)網(wǎng)長距離無線通信技術(shù)應(yīng)用與開發(fā)
- 工業(yè)互聯(lián)網(wǎng)創(chuàng)新實(shí)踐
- 網(wǎng)絡(luò)綜合布線(第2版)
- 深入理解Nginx:模塊開發(fā)與架構(gòu)解析
- 計(jì)算機(jī)網(wǎng)絡(luò)技術(shù)
- 人際網(wǎng)絡(luò)
- React Design Patterns and Best Practices(Second Edition)