0

I have a project in javaFX and I'm using ControllerFX Library , the problem here in the .jar file it's necessery to keep .jar file of the library with my .jar project. is there a way to combine .jar of library with .jar of project using intellij idea ? does Maven help in this situation? (I don't know exactly what maven can do) thanks for answers

HinoHara
  • 572
  • 3
  • 13
  • 24

1 Answers1

4

The jars that you use with your project are called as the dependent jars. You can bundle them while creating a jar of your own project.

Intellij Approach

File
  |
  Project Structure 
     | 
     Artifacts
           |
           create new artifact choose --> jar --> From modules with dependencies.

Next goto

Build 
   | 
   Build artifacts --> choose your artifact

Maven Approach

  1. Create a Maven project and keep the packaging as jar.
  2. Add the executable jar plugin and add your Main class details and your dependent jars
<build>
  <plugins>
     <plugin>
       <artifactId>maven-assembly-plugin</artifactId>
         <configuration>
           <descriptorRefs>
             <descriptorRef>jar-with-dependencies</descriptorRef>
           </descriptorRefs>
           <archive>
             <manifest>
               <mainClass>fully.qualified.MainClass</mainClass>
             </manifest>
           </archive>
         </configuration>
      </plugin>
   </plugins>
</build>
ItachiUchiha
  • 36,135
  • 10
  • 122
  • 176