Tornadofx learning notes (3) — compiling into jar package with maven

Time:2020-6-22

I used the tools of idea to compile jar package

Tornadofx learning notes (3) -- compiling into jar package with maven

But it is too troublesome to add new dependency and modify the dependency of project structure

Tornadofx learning notes (3) -- compiling into jar package with maven

One day when I was developing Android, I thought that gradle can be packaged with one click, whether it can be Maven or not. Baidu searched it and found a way

The author of tornadofx has developed the project creation tool of idea, which can directly create a tornadofx project, as shown in the following figure

Tornadofx learning notes (3) -- compiling into jar package with maven

As you can see, it also supports gradle, but I haven’t used gradle for java development, so I’m not bothered. I’m using Maven

Packaging with Maven requires pom.xml File to add the assembly plug-in, and then I changed it a little bit

org.apache.maven.plugins
    maven-assembly-plugin
    2.2
    
        
        demo
        
        out
        false
        
            
                
                com.starsone.app.MyApp
            
        
        
            
            
                jar-with-dependencies

Copy the above plug-in to pol.xml In the plugins tab, you only need to change the entry class to your entry class, other output directories and output file names can be changed

After that, open the Maven menu on the right and select pack and go

Tornadofx learning notes (3) -- compiling into jar package with maven

reference resources:

Can I rename Maven jar with dependencies?
Maven generates package executable jar package