2

I need to create a jar with compiled classes from a package which is inside of the module. I have a jar file which is actually a package inside of the module and I need to re-create it.

I can create jar of the whole module but I could not create the jar file of the package. How can I do that on idea?

dev dev
  • 61
  • 1
  • 7

1 Answers1

5

Intellij IDEA 2016.3


  1. File -> Project Structure...
  2. Project Settings -> Artifact in the left column
  3. "+" in the middle column -> JAR -> Empty -> Type name
  4. Click the created Name in the middle column
  5. Output Layout (right column) -> "+" (Add Copy of) -> Directory Content If your .class file is in com.myprojects.myfirstproject you should create "com" folder in the root of jar, "myprojects" folder in the "com" folder, "myfirstproject" in the "myprojects" folder
  6. "+" -> File -> select your .class files from com.myprojects.myfirstproject
  7. Create Manifest File in the root of jar
  8. Specify Main Class as "com.myprojects.myfirstproject.Main"
  9. Apply

  1. In the IDEA Top Menu: Build -> Build Artifacts... -> select your artifact -> Build.

You can find the created artifact in the Output directory specified on the step 3.

Andrei Veshtard
  • 528
  • 9
  • 12