为Maven项目创建可执行JAR?

时间:2018-03-20 19:27:00

标签: java apache maven jar jena

我正在按照create an executable JAR using Maven的回答。但是,我想出了以下错误:

> SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.lang.ExceptionInInitializerError
    at me.vijaychavda.rdfr.Reifier.do_reify(Reifier.java:82)
    at me.vijaychavda.rdfr.Reifier.reify(Reifier.java:63)
    at me.vijaychavda.rdfr.Reifier.reify(Reifier.java:73)
    at me.vijaychavda.rdfr.Main.main(Main.java:30)
Caused by: java.lang.NullPointerException
    at org.apache.jena.tdb.sys.EnvTDB.processGlobalSystemProperties(EnvTDB.java:33)
    at org.apache.jena.tdb.TDB.init(TDB.java:249)
    at org.apache.jena.tdb.sys.InitTDB.start(InitTDB.java:29)
    at org.apache.jena.system.JenaSystem.lambda$init$2(JenaSystem.java:119)
    at java.util.ArrayList.forEach(ArrayList.java:1255)
    at org.apache.jena.system.JenaSystem.forEach(JenaSystem.java:194)
    at org.apache.jena.system.JenaSystem.forEach(JenaSystem.java:171)
    at org.apache.jena.system.JenaSystem.init(JenaSystem.java:117)
    at org.apache.jena.rdf.model.ModelFactory.<clinit>(ModelFactory.java:49)
    ... 4 more

This回答帮我摆脱了SLF4J错误,但在添加依赖项后,我仍然收到此错误:

> Exception in thread "main" java.lang.ExceptionInInitializerError
    at me.vijaychavda.rdfr.Reifier.do_reify(Reifier.java:82)
    at me.vijaychavda.rdfr.Reifier.reify(Reifier.java:63)
    at me.vijaychavda.rdfr.Reifier.reify(Reifier.java:73)
    at me.vijaychavda.rdfr.Main.main(Main.java:30)
Caused by: java.lang.NullPointerException
    at org.apache.jena.tdb.sys.EnvTDB.processGlobalSystemProperties(EnvTDB.java:33)
    at org.apache.jena.tdb.TDB.init(TDB.java:249)
    at org.apache.jena.tdb.sys.InitTDB.start(InitTDB.java:29)
    at org.apache.jena.system.JenaSystem.lambda$init$2(JenaSystem.java:119)
    at java.util.ArrayList.forEach(ArrayList.java:1255)
    at org.apache.jena.system.JenaSystem.forEach(JenaSystem.java:194)
    at org.apache.jena.system.JenaSystem.forEach(JenaSystem.java:171)
    at org.apache.jena.system.JenaSystem.init(JenaSystem.java:117)
    at org.apache.jena.rdf.model.ModelFactory.<clinit>(ModelFactory.java:49)
    ... 4 more

我的项目正在使用Apache的Jena库。

其实我是Maven的新手,我只是想为我的Java项目创建可执行的JAR:)

编辑1:

我还尝试使用Shade插件thisthis method,但同样的错误!

编辑2: 代码运行正常,没有任何错误。当我尝试创建JAR时会出现这些错误。

1 个答案:

答案 0 :(得分:0)