1. 程式人生 > >springboot打包成可執行Jar檔案教程

springboot打包成可執行Jar檔案教程

        <plugin> 
            <groupId>org.apache.maven.plugins</groupId> 
            <artifactId>maven-jar-plugin</artifactId> 
            <version>2.3.2</version> 
            <configuration> 
                <archive> 
                    <manifest> 
                        <!--change addClasspath to true if daks is desktop version--> 
                        <addClasspath>true</addClasspath> 
                        <classpathPrefix>lib/</classpathPrefix> 
                        <mainClass>com.panminlan.Application</mainClass> 
                        <addDefaultImplementationEntries>true</addDefaultImplementationEntries> 
                        <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries> 
                    </manifest> 
                    <manifestEntries> 
                        <Permissions>${Permissions}</Permissions> 
                        <Caller-Allowable-Codebase>${Caller-Allowable-Codebase}</Caller-Allowable-Codebase> 
                    </manifestEntries> 
                </archive> 
            </configuration> 
        </plugin> 
        <plugin> 
            <groupId>org.apache.maven.plugins</groupId> 
            <artifactId>maven-dependency-plugin</artifactId> 
            <version>2.3</version> 
            <executions> 
                <execution> 
                    <id>copy-dependencies</id> 
                    <phase>package</phase> 
                    <configuration> 
                        <overWriteReleases>false</overWriteReleases> 
                        <overWriteSnapshots>false</overWriteSnapshots> 
                        <overWriteIfNewer>true</overWriteIfNewer> 
                        <outputDirectory> 
                          ${project.build.directory}/lib
                        </outputDirectory> 
                    </configuration> 
                    <goals> 
                        <goal>copy-dependencies</goal> 
                    </goals> 
                </execution> 
            </executions> 
        </plugin>