Log4j library case - "Eclipse In Action" 8.4

xiaoxiao2021-03-06  52

Eclipse version: 3.0.1

JAKARTA log4j version: 1.2.8

1. Create a log4J library plugin

1) File> New> Plug-in Project

2) Enter the project name: org.apache.log4j

3) The plugin version is changed to 1.2.8; the plugin name is changed to apache log4j; specify the name of the provider; because the plugin itself does not need to provide code, you will go off the option to create the plugin class.

4) Click the Finish button to complete the project creation

5) File> Import> File System, import log4j-1.2.8.jar, renamed Log4j.jar

6) Right click on the project, choose Properties

7) Select Java Build Path> Libraries, click Add Jars, add log4j.jar

8) Select Java Build Path> ORDER AND EXPORT, select log4j.jar

9) Since the plugin itself does not need to provide code, it is removed from the source.log4j.jar and output.log4j.jar entry in build.properties.

The list of Plugin.xml and build.properties after the creation is as follows:

Plugin.xml:

ID = "org.apache.log4j"

Name = "apache log4j"

Version = "1.2.8"

Provider-name = "Nelson_tu">

Build.properties:

bin.includes = plugin.xml, /

Log4j.jar

2, additional source code

Additional log4j source code in the plugin so that users view.

1) Pack the source code in the log4j's SRC / Java directory into log4jsrc.zip

2) File> Import> File System, import log4jsrc.zip

3) Right-click Log4j.jar, select Properties

4) Select Java Source Attachment, click Workspace, select Log4jsrc.zip; this way, associate the source code to log4j.jar

5) Double-click PLUGIN.XML, open the list editor, select the log4jsrc.zip in the Binary Build part of the build option page, and contain it to the plugin.

BUILD.PROPERTIES list changes as follows:

bin.includes = plugin.xml, /

Log4j.jar, /

Log4jsrc.zip

3, release plugin

1) File> Export2) Select Deployable Plug-Ins and Fragments

3) Select Org.Apache.log4j (1.2.8) plugin

4) Deploy as selection A Single Zip file

5) The specified file name is org.apache.log4j_1.2.8.zip

6) Click Finish to complete the plugin output

转载请注明原文地址:https://www.9cbs.com/read-109711.html

New Post(0)