봄 부팅 정적 리소스 격리 된 항아리 포장

폼은

	<build>
		<plugins>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
				</configuration>
			</plugin>
			<plugin>
		        <groupId>org.apache.maven.plugins</groupId>
		        <artifactId>maven-dependency-plugin</artifactId>
		        <executions>
		          <execution>
		            <id>copy-dependencies</id>
		            <phase>package</phase>
		            <goals>
		              <goal>copy-dependencies</goal>
		            </goals>
		            <configuration>
		              <outputDirectory>target/lib</outputDirectory>
		              <excludeTransitive>false</excludeTransitive>
		              <stripVersion>false</stripVersion>
		              <includeScope>runtime</includeScope>
		            </configuration>
		          </execution>
		        </executions>
     		</plugin>
     		<plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <excludes>
            <exclude>**/*.properties</exclude>
            <exclude>**/*.xml</exclude>
            <exclude>**/*.yml</exclude>
            <exclude>admin/**</exclude>
            <exclude>mapper/**</exclude>
            <exclude>excel/**</exclude>
            <exclude>excelXml/**</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <configuration>
          <layout>ZIP</layout>
          <includes>
            <include>
              <groupId>non-exists</groupId>
              <artifactId>non-exists</artifactId>
            </include>
          </includes>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>repackage</goal>
            </goals>
            <configuration>
              <classifier>classes</classifier>
              <attach>false</attach>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <property name="dist">target/distribution</property>
                <property name="dist-tmp">target/distribution/tmp</property>
                <property name="app-name">${project.artifactId}-${project.version}</property>
                <mkdir dir="${dist-tmp}" />
                <copy file="target/${app-name}.jar" tofile="${dist-tmp}/${app-name}.jar" />
                <unzip src="${dist-tmp}/${app-name}.jar" dest="${dist-tmp}" />
                <delete file="${dist-tmp}/${app-name}.jar" />
                <zip destfile="${dist}/${app-name}-pages.jar">
                  <zipfileset dir="${dist-tmp}/META-INF" prefix="META-INF" />
                </zip>
                <move file="target/${app-name}-classes.jar" todir="${dist}" />
                <move todir="${dist}/3rd-lib">
                  <fileset dir="target/lib" />
                </move>
                <delete dir="${dist-tmp}" />
                <copy todir="${dist}">
                  <fileset dir="target/classes">
                    <include name="**/*.properties" />
                    <include name="**/*.xml" />
                    <include name="**/*.yml" />
                    <include name="admin/**" />
                    <include name="mapper/**" />
                    <include name="excel/**" />
                    <include name="excelXml/**" />
                  </fileset>
                </copy>
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>

		</plugins>
	</build>

주로를 통해       

<구성>
          <제외가>
            ** / * <제외>. 속성 </ 제외>
            <제외> ** / *. XML </ 제외>
            <제외> ** / *. YML </ 제외>
            <제외> 관리자 / ** <제외 />
            <제외> 매퍼 / ** </ 제외>
            <제외> 엑셀 / ** </ 제외>
            <제외> excelXml / ** </ 제외>
          </ 제외>
</ 구성>

별도의 정적 리소스,

 <todir = "$ {DIST}"복사>
                  <세트 DIR = "타겟 / 클래스">
                    <이름 = 포함 "** / *이. 속성"/가>
                    <NAME = 포함 "** / *한다. XML을"/>
                    < 이름을 포함 = "** / *. YML"/>
                    <포함 이름 = "관리자 / **"/>
                    <포함 이름 = "매퍼 / **"/>
                    <포함 이름 = "엑셀 / **"/>
                    < 등 이름 = "excelXml / **"/>
                  </ 세트>
    </ 복사>

정적 자원을 복사

명령을 시작합니다 : 자바 -jar -Dloader.path = 3-lib 디렉토리 XXX-0.0.1-SNAPSHOT-classes.jar를.

추천

출처blog.csdn.net/syilt/article/details/92989306