简体   繁体   English

如何为我的 Discord 机器人重建 JAR 文件?

[英]How do I rebuild the JAR file for my Discord bot?

I've had someone create a Discord bot for me.我已经有人为我创建了一个 Discord 机器人。 I need to change some grammar from it so I grabbed the source code from him and changed the title lines to what I need changed.我需要从中更改一些语法,所以我从他那里获取了源代码并将标题行更改为我需要更改的内容。

Example:例子:

.setTitle("Tier information here")

Fixed:固定的:

.setTitle("Tier information:")

When I try and create the JAR file and upload it onto my host, it gives an error.当我尝试创建 JAR 文件并将其上传到我的主机时,它会出错。

Am I supposed to do something else after I change the titles?更改标题后我应该做其他事情吗? Or am I just messing up on the JAR creation part?还是我只是搞砸了 JAR 创建部分?

My pom.xml contains:我的 pom.xml 包含:

<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>

maven-shade-plugin and 3.2.4 is red. maven-shade-plugin 和 3.2.4 是红色的。 Does that have anything to do with it?这有什么关系吗?

I updated maven-shade-plugin and refreshed and recreated the JAR and it's still not working.我更新了 maven-shade-plugin 并刷新并重新创建了 JAR,但它仍然无法正常工作。

You have a pom.xml in the sources.您在源代码中有一个 pom.xml。 That strongly indicates you should be running a maven build.这强烈表明您应该运行 maven 构建。 In case you never heard of Maven, check http://maven.apache.org/如果您从未听说过 Maven,请查看http://maven.apache.org/

So what you need to do:所以你需要做的:

  • ensure you have a recent version of Java installed确保您安装了最新版本的 Java
  • ensure you have a recent version of Maven installed确保您安装了最新版本的 Maven
  • ensure you can run mvn from the command line确保您可以从命令行运行mvn

Then on the command line cd into your project directory.然后在命令行 cd 进入你的项目目录。 Run mvn package .运行mvn package Maven should startup, download all further dependencies and run until your jar file exists. Maven 应该启动,下载所有进一步的依赖项并运行,直到您的 jar 文件存在。

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

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