通过maven打可执行jar包

pom.xml增加如下内容

    <build>
        <plugins>
<plugin>
                <artifactId>maven-assembly-pluginartifactId>
                <version>3.4.2version>
                <configuration>
                    <archive>
                        <manifest>
                            
                            <mainClass>org.joe.AppmainClass>
                        manifest>
                    archive>
                    <appendAssemblyId>falseappendAssemblyId>
                    
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependenciesdescriptorRef>
                    descriptorRefs>
                    
                    <outputDirectory>${project.build.directory}/maven-assembly-pluginoutputDirectory>
                configuration>
                <executions>
                    <execution>
                        <id>make-assemblyid>
                        <phase>packagephase>
                        <goals>
                            <goal>singlegoal>
                        goals>
                    execution>
                executions>
            plugin>
        plugins>
    build>

命令行执行如下命令进行打包

 mvn clean package assembly:single 

你可能感兴趣的:(maven,jar,java)