مقدمة
يستخدم Springboot حزمة JAR لفصل ملفات LIB والتكوين. لم أجربها. بعد مناقشته مع Liu Dashen (لا يحتوي الله العظيم على مدونة ، إنه أمر مؤسف) ، لقد أعطيت هذا الحل للرجوع إليه.
بيئة النشر
pom.xml
<؟ XSI: schemalocation = "http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <soph> 0.0.1-snapshot </version> <packaging> جرة </packaging> <name> اختبار </name> <description> اختبار </description> <parent> <roupiD> org.springframework.boot </groupid> <shifactid> spring-boot-starter-parent </artifactid> <Properties> <project.build.sourceencoding> utf-8 </project.build.sourceencoding> <project.reporting.outputencoding> utf-8 </project.reporting <roupl> org.springframework.boot </groupId> <StifactId> Spring-boot-starter-web </shintifactid> </sependency> <reperence> <roupiD> org.springframework.boo </groupid> <uccedins> <lopin> <roupiD> org.apache.maven.plugins </groupId> <StifactId> plugin المعتمدة على maven </intifactid> <evelopmions> <evelop> <id> copy-dependents </id> package </fash <DountedDirectory> الهدف/lib </ourcedirectory> <SectiveTransitive> false </arcorudeRansitive> <stripversion> خطأ </stripversion> <sclostesCope> وقت التشغيل </includeScope> </isplisturation> </execution> </executions> <StifactId> maven-jar-plugin </artifactId> <configuration> <assects> <arcorude> **/*. الخصائص </exclude> <splude> **/*. </simpution> </suncloy> <clupin> <rougiD> org.springframework.boot </rougiD> <StifactId> spring-boot-maven-plugin </stifactid> <evelopments> <evelop> <irod> <vise> إعادة التدوير </tild> </forts> <configuration> <slassifier> فئات </classifier> <atched> false </taching> </ispult> </evention> </executions> </plugin> <cludin> <StifactId> maven-antrun-plugin </shintifactid> <evelopmentions> <evelop> <phase> الحزمة </phase> <irod> <irod> Run </sivel> </tore> <nugmuration> <target> <property name = "dist"> الهدف/التوزيع </property> name = "app-name"> $ {project.artifactid}-$ {project.version} </property> <mkdir dir = "$ {dist-tmp}"/> <copy file = "target/$ {app-name} .jar" tofile = "$ {dist-tmp}/$ {app-name}. src = "$ {dist-tmp}/$ {app-name} .jar" dest = "$ {dist-tmp}"/> <delete file = "$ {dist-tmp}/$ {app-name} .jar"/> <zip destfile = "$}/$ {app-name}-pages.jar" dir = "$ {dist-tmp}/meta-inf" prefix = "meta-inf"/> <zipfileset dir = "target/classes/static" prefix = "static"/> <zipfileset dir = "target/classes/templates" prefix = "templates"/> </zip> TODIR = "$ {dist}"/> <move todir = "$ {dist}/3rd-lib"> <fileset dir = "target/lib"/> </move> <dilete dir = "target/{dist-tmp}"/> <copy todir = "$ {dist}"> <ipletet dir = "target/include <champl} name = "**/*. xml"/> <تضمين name = "**/*.بعد انتهاء الحزمة
الجرة الجرة
java -jar -dloader.path =. ، 3rd-lib test-0.0.1-snapshot-class.jar
لخص
ما سبق هو طريقة التكوين الصحيحة لفصل LIB عن حزم جرة التمهيد الربيعي الذي قدمه لك المحرر. آمل أن يكون ذلك مفيدًا لك. إذا كان لديك أي أسئلة ، فيرجى ترك رسالة لي وسوف يرد المحرر إليك في الوقت المناسب. شكرا جزيلا لدعمكم لموقع wulin.com!