问题
I am attempting to create a JAR from IntelliJ using the build artifacts but when I do it is saying
Error: Invalid or corrupt jarfile
Im not sure what im doing wrong though?
回答1:
Hard to tell from what you have posted. Intellij can be finicky at times especially with the Artifact jar build interface. There is a good tutorial on IntelliJ's website on how to set up the artifact. One area that may provide difficulty is pointing to the Main Class.
An issue I had in building a jar using the tool was selecting the Main Class. Ultimately I typed it in and it worked. Not sure if this is the advice that will solve your problem.
From the intellij website at: https://www.jetbrains.com/help/idea/creating-and-running-your-first-java-application.html
Note the image below.
Other potential issues could be that a dependency was corrupted, although doubtful.
Could also be the Manifest file is referencing a file that is causing the issue. Most Manifest files should be fairly simple and point to the main class. Last but not least email IntelliJ. They are good at responding and if the problem is one that intellij can solve, they will help. Unfortunately they only respond by email and sometimes can take up to a day.
来源:https://stackoverflow.com/questions/58036941/generate-jar-from-intellij