简体   繁体   English

将 HikariCP 着色到 jar 中不起作用

[英]Shading HikariCP into jar won't work

Now this seems so weird, that it shouldn't happen.现在这看起来很奇怪,它不应该发生。 Anyways, let me explain what's going on: I'm making a bukkit plugin which happens to need database access.不管怎样,让我解释一下发生了什么:我正在制作一个 bukkit 插件,它恰好需要访问数据库。 For that, I'm using HikariCP.为此,我正在使用 HikariCP。 I've used it before in several project and I should have no issues with it, but something really weird just happened.我之前在几个项目中使用过它,我应该没有问题,但是发生了一些非常奇怪的事情。 After adding it as dependency to my pom and configured the shade plugin to shade it, I built the jar.在将它作为依赖项添加到我的 pom 并配置 shade 插件以对其进行着色后,我构建了 jar。 I even checked its contents by using Winrar to unarchive it, and it all looked as it should.我什至使用 Winrar 解压缩它来检查它的内容,一切看起来都应该如此。 However, as soon as I loaded it, I got the NoClassDefFound exception.然而,一旦我加载它,我就得到了 NoClassDefFound 异常。 I'll provide the pom here if that helps you, but as I said, the final jar looks fine.如果对您有帮助,我会在这里提供 pom,但正如我所说,最终的 jar 看起来不错。 Also, if you're not familiar with Bukkit and the way it handles plugins, it's pretty simple.此外,如果您不熟悉 Bukkit 以及它处理插件的方式,这很简单。 It basically has a folder where you place your jars (plugins).它基本上有一个文件夹,您可以在其中放置 jar(插件)。 It then scans through it and then loads the main class of your plugin (which is defined in a yml file in the jar and must extend JavaPlugin) and then calls the onEnable() method inside the main class.然后它扫描它,然后加载插件的主类(在 jar 中的 yml 文件中定义并且必须扩展 JavaPlugin),然后调用主类中的onEnable()方法。

EDIT: Forgot to add the pom, here it is: http://hastebin.com/rapijoyona.xml Also, if you need the stack trace: http://hastebin.com/owazutekum.go编辑:忘记添加 pom,这里是: http : //hastebin.com/rapijoyona.xml另外,如果您需要堆栈跟踪: http : //hastebin.com/owazutekum.go

You must define what should be shaded.您必须定义应该着色的内容。

<execution>       
    <phase>package</phase>
    <goals>
        <goal>shade</goal>
    </goals>
    <configuration>
        <shadedArtifactId>${project.artifactId}-${minecraft.version}</shadedArtifactId>
        <shadedArtifactAttached>true</shadedArtifactAttached>
        <shadedClassifierName>shaded</shadedClassifierName>
        <minimizeJar>true</minimizeJar>
        <!-- INCLUDE SHADE-->
        <artifactSet>              
            <includes>
                <include>groupId:artifactId</include>
            </includes> 
        </artifactSet>          
    </configuration>        
</execution>

And yes, I read what you wrote, but try it maybe this works better是的,我读了你写的东西,但试试看也许这会更好

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM