早安,
我尝试使用Apache Maven 3.6.0(Java版本:1.8.0_181,供应商:Oracle Corporation,运行时:C:\ Program Files \ Java \ jdk1.8.0)构建“ jul-to-log4j-bridge” jar文件_181 \ jre) 目的是将JUL重定向到log4j 1.2.17。
我是Java开发人员领域的新手,没有实际背景,但是: 我安装了svn OK 我从http://svn.apache.org/repos/asf/logging/sandbox/jul-to-log4j-bridge/ usign svn收集了资料 (svn导出http://svn.apache.org/repos/asf/logging/sandbox/jul-to-log4j-bridge/) 我安装了JDK 1.8.0_181 OK 我安装了maven 3.6.0可以
我修改了build.plugins.plugin的版本,因为它们缺少:
[警告] org.apache.maven.plugins的'build.plugins.plugin.version':缺少maven-compiler-plugin。 @第102行,第15列 [警告] org.codehaus.mojo:cobertura-maven-plugin的'build.plugins.plugin.version'丢失。 @ 109行,第15列 [警告] org.apache.maven.plugins:maven-checkstyle-plugin的'build.plugins.plugin.version'丢失。 @第92行,第15列 [警告] org.apache.maven.plugins:maven-source-plugin的'build.plugins.plugin.version'丢失。 @ 152行,第15列
使用这种命令:mvn help:描述-DartifactId = cobertura-maven-plugin -DgroupId = org.codehaus.mojo =>我修改了pom.xml
但是我偶然发现了maven的导入/包/插件等概念,因为我从“ mvn包”中得到的错误消息是:
[INFO] -------------< org.apache.logging:apache-jul-log4j-bridge >-------------
[INFO] Building java.util.logging to log4j Bridge 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ apache-jul-log4j-bridge ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ apache-jul-log4j-bridge ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 8 source files to C:\Users\llv\Documents\@D\Part\maven\svn\jul-to-log4j-bridge\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/llv/Documents/@D/Part/maven/svn/jul-to-log4j-bridge/src/main/java/org/apache/log4j/jul/JULReceiver.java:[19,32] package org.apache.log4j.plugins does not exist
有人可以帮助通过这个低谷吗? 这是关于JULReceiver.java的。 任何帮助都非常感谢。
谢谢
答案 0 :(得分:0)
搜索,谷歌搜索,我成立了:
https://logging.apache.org/log4j/extras/
https://logging.apache.org/log4j/extras/apidocs/org/apache/log4j/component/plugins/Receiver.html
还有宾果游戏! 软件包“ org.apache.log4j.plugins”在apache-log4j-extras 1.2.17中不存在
但是包“ org.apache.log4j.component.plugins”可以! 所以我从:
更新了JULReceiver.java。import org.apache.log4j.plugins.Plugin;
import org.apache.log4j.plugins.PluginSkeleton;
收件人:
import org.apache.log4j.component.plugins.Plugin;
import org.apache.log4j.component.plugins.PluginSkeleton;
编译成功
[INFO] --- maven-source-plugin:3.0.1:jar (default) @ apache-jul-log4j-bridge ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.813 s
[INFO] Finished at: 2018-11-08T09:43:07+01:00
[INFO] ------------------------------------------------------------------------
但是现在tomcat 7.0.23停止了,只剩下:
1 /我将jar放在类路径中: D:\ appli \ tomcat \ instances \ desktop11 \ lib \ apache-jul-log4j-bridge-1.0.0-SNAPSHOT.jar;
2 /我在JVM中使用JUL配置了所有应用程序,以使用“ apache-jul-log4j-bridge” JVM参数:
-Djava.util.logging.manager=org.apache.logging.julbridge.JULBridgeLogManager
代替“经典”:
-Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
JVM在以下位置启动:D:\ opt \ jdk1.7.0_80 \ jre \ bin \ server \ jvm.dll
我想tomcat(内部使用JUL)不支持此java.util.logging.manager ..
或可能是由于编译时出现此错误(而不是阻塞),我在该错误中看到了关于stackoverflow的信息,但是给出的修复导致了另一个pb(我将继续探索..)
[INFO] Compiling 9 source files to C:\Users\llv\Documents\@D\Part\maven\svn\jul-to-log4j-bridge\target\test-classes
[WARNING] /C:/Users/llv/Documents/@D/Part/maven/svn/jul-to-log4j-bridge/src/test/java/org/apache/logging/julbridge/MockAppender.java: C:\Users\llv\Documents\@D\Part\maven\svn\jul-to-log4j-bridge\src\test\java\org\apache\logging\julbridge\MockAppender.java uses unchecked or unsafe operations.
[WARNING] /C:/Users/llv/Documents/@D/Part/maven/svn/jul-to-log4j-bridge/src/test/java/org/apache/logging/julbridge/MockAppender.java: Recompile with -Xlint:unchecked for details.
但是,有人可以帮助我吗? 谢谢