Maven Jar Builder: Could not find or load main class

前端 未结 4 1231
谎友^
谎友^ 2020-12-19 13:57

I have been trying for several days now to create an executable jar file for my muli-module maven project. However, when I try to run this jar file I get \"Could not find or

4条回答
  •  执笔经年
    2020-12-19 14:21

    it seems like you have one of the plugins missing. add the bellow to pom.xml file

    
        org.apache.maven.plugins
        maven-jar-plugin
        2.6
        
                
                    
                        true
                        yourclassnameKt
                    
                
        
    
    

    The plugin will add MANIFEST.mf file, which will tell the Java runtime which class to execute.

    There is another issue that has the same problem -> Kotlin + Maven assembling: no main manifest attribute

    Reference: https://michaelrice.com/2016/08/hello-world-with-kotlin-and-maven/

提交回复
热议问题