Maven – Exclude log4j.properties in Jar file Posted on October 19, 2014 By mkyong This example sho
来源:互联网 发布:大数据的4v特征是指 编辑:程序博客网 时间:2024/04/29 09:06
Maven – Exclude log4j.properties in Jar file
This example shows you how to use Maven to exclude the log4j.properties
file from your Jar file.
Note
Please, DO NOT include the log4j.properties
into the final Jar file, it will cause multiplelog4j.properties
files in the classpath, if someone is depending on your Jar, you may accidentally override their logging configurations, depends which Jar is loaded first.pom.xml<project> <build> <plugins> <!-- Make this jar executable --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-jar-plugin</artifactId><configuration> <!-- exclude log4j.properties --><excludes><exclude>**/log4j.properties</exclude></excludes><archive> <manifest><addClasspath>true</addClasspath><mainClass>com.mkyong.core.utils.testing</mainClass><classpathPrefix>dependency-jars/</classpathPrefix> </manifest></archive></configuration></plugin> </plugins> </build> </project>
Please pass in your log4j.properties
file via log4j.configuration
system property like this
$ java -jar -Dlog4j.configuration=file:/full_path/log4j.properties final.jar
This example shows you how to use Maven to exclude the log4j.properties
file from your Jar file.
Note
Please, DO NOT include the
Please, DO NOT include the
log4j.properties
into the final Jar file, it will cause multiplelog4j.properties
files in the classpath, if someone is depending on your Jar, you may accidentally override their logging configurations, depends which Jar is loaded first.pom.xml
<project> <build> <plugins> <!-- Make this jar executable --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-jar-plugin</artifactId><configuration> <!-- exclude log4j.properties --><excludes><exclude>**/log4j.properties</exclude></excludes><archive> <manifest><addClasspath>true</addClasspath><mainClass>com.mkyong.core.utils.testing</mainClass><classpathPrefix>dependency-jars/</classpathPrefix> </manifest></archive></configuration></plugin> </plugins> </build> </project>
Please pass in your log4j.properties
file via log4j.configuration
system property like this
$ java -jar -Dlog4j.configuration=file:/full_path/log4j.properties final.jar
This example shows you how to use Maven to exclude the log4j.properties
file from your Jar file.
Note
Please, DO NOT include the
Please, DO NOT include the
log4j.properties
into the final Jar file, it will cause multiplelog4j.properties
files in the classpath, if someone is depending on your Jar, you may accidentally override their logging configurations, depends which Jar is loaded first.pom.xml
<project> <build> <plugins> <!-- Make this jar executable --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-jar-plugin</artifactId><configuration> <!-- exclude log4j.properties --><excludes><exclude>**/log4j.properties</exclude></excludes><archive> <manifest><addClasspath>true</addClasspath><mainClass>com.mkyong.core.utils.testing</mainClass><classpathPrefix>dependency-jars/</classpathPrefix> </manifest></archive></configuration></plugin> </plugins> </build> </project>
Please pass in your log4j.properties
file via log4j.configuration
system property like this
$ java -jar -Dlog4j.configuration=file:/full_path/log4j.properties final.jar
0 0
- Maven – Exclude log4j.properties in Jar file Posted on October 19, 2014 By mkyong This example sho
- Maven – Exclude logback.xml in Jar file
- Maven – Create a fat Jar file – One-JAR example
- Read properties file in a jar
- Log4j Property File Example
- log4j.properties未包含在maven打成的jar中
- maven: install jar file in local repository
- Sample log4j.properties file
- Maven by example
- Maven by Example
- Watch 18+ Videos On Youtube Without Signing In 12:30 Posted by Nakib Momin Labels: INTERESTING TRIC
- Hibernate Criteria examples by mkyong
- maven log4j.jar问题
- maven log4j.jar问题
- Maven by Example 3.1. Introduction
- log4j.jar log4j.properties 配置与使用
- log4j.properties例子:log4j.appender.file.DatePattern
- How to exclude jars generated by maven war plugin
- firefox(firebug) 查看 primefaces 标签的自定义CSS
- 配置高并发jdbc连接池
- android 集成第三方静态库的编译方法
- Eclipse搭建SSH(Struts2+Spring3+Hibernate3)框架项目教程
- nutch编译的时候下载文件卡死的解决方案
- Maven – Exclude log4j.properties in Jar file Posted on October 19, 2014 By mkyong This example sho
- Redis Sentinel集群方案--单机测试
- Python 之斐波那契数列中用到的append
- 【BZOJ 3192】 [JLOI2013]删除物品
- 2014-12-1 xen上的vuart
- TCP/IP 问题回答(一)
- Maven – Exclude logback.xml in Jar file
- 三.windows和Linux文件共享
- golang中new和make区别