How to build JARs from IntelliJ properly?
Here's how to build a jar with IntelliJ 10 http://blogs.jetbrains.com/idea/2010/08/quickly-create-jar-artifact/
File -> Project Structure -> Project Settings -> Artifacts -> Click green plus sign -> Jar -> From modules with dependencies...
Select a Main Class (the one with main()
method) if you need to make the jar runnable.
The above sets the "skeleton" to where the jar will be saved to. To actually build and save it do the following:
Extract to the target Jar
OK
Build | Build Artifact | Build
Try Extracting the .jar file from
ProjectName | out | artifacts | ProjectName_jar | ProjectName.jar
Compile package to library .jar
If you create a plain Java module for your code, the build process will automatically create a jar of it and put it in the build/libs directory. If you want more explicit control over jar file generation, you can read about the Java plugin's jar task at http://www.gradle.org/docs/current/userguide/java_plugin.html
Correct way to add external jars (lib/*.jar) to an IntelliJ IDEA project
Steps for adding external jars in IntelliJ IDEA:
- Click File from the toolbar
- Select Project Structure option (CTRL + SHIFT + ALT + S on Windows/Linux, ⌘ + ; on Mac OS X)
- Select Modules at the left panel
- Select Dependencies tab
- Select + icon
- Select 1 JARs or directories option
Related Topics
Spring Data: Override Save Method
Why Are the Level.Fine Logging Messages Not Showing
Efficiently Compute Intersection of Two Sets in Java
How to Encode Uri Parameter Values
Arraylist or List Declaration in Java
What's the Default Value of Char
How to Set Java_Home in MAC Permanently
Arrays.Aslist(Int[]) Not Working
Exception in Thread 'Main' Java.Lang.Noclassdeffounderror:
How to Get a Unicode Character's Code
Jtable Row Hightlighter Based on Value from Tablecell
Using Java to Decrypt Openssl Aes-256-Cbc Using Provided Key and Iv
Java Convert Gmt/Utc to Local Time Doesn't Work as Expected
Replacing If Else Statement with Pattern
Accessing the Last Entry in a Map