官术网_书友最值得收藏!

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.

主站蜘蛛池模板: 旬阳县| 景宁| 青龙| 滦平县| 利川市| 乐清市| 彭州市| 九寨沟县| 嘉鱼县| 上杭县| 探索| 景德镇市| 嘉黎县| 延庆县| 拉萨市| 壶关县| 蒲江县| 仪陇县| 遂溪县| 土默特右旗| 榆林市| 穆棱市| 天台县| 安泽县| 黎川县| 荆门市| 蓬溪县| 临清市| 托克托县| 方城县| 紫金县| 瑞丽市| 镇赉县| 丹棱县| 团风县| 永安市| 宜城市| 通山县| 三门峡市| 东山县| 梅河口市|