我們的項目設置打包戰爭,這爲當地發展的偉大工程:如何通過將資源移出戰爭來打包Maven中的程序集?
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>package-war</id>
<phase>package</phase>
<goals>
<goal>war</goal>
</goals>
...
包括在這場戰爭中,是由應用程序使用的映射文件的logback文件,這下生活:src/main/resources/logback.xml
和/src/main/resources/mappers/our-mapper.xml
。
在構建戰爭中,這些文件被髮送,我們期待並希望他們,our.war/WEB-INF/classes/logback.xml
和our.war/WEB-INF/classes/mappers/our-mapper.xml
下,當我們包裝我們組裝,隨手關閉的部署,我們需要有這些文件中分離出來的戰爭,這是我們用我們的裝配描述:
<assembly>
<formats>
<format>tar.gz</format>
</formats>
<includeBaseDirectory>false</includeBaseDirectory>
<files>
<file>
<source>target/${build.finalName}.war</source>
<outputDirectory>${tomcat-instance}/webapps</outputDirectory>
</file>
<file>
<source>src/main/resources/logback.xml</source>
<outputDirectory>${tomcat-instance}/resources/</outputDirectory>
</file>
</files>
<fileSets>
<fileSet>
<directory>src/main/resources/mapper</directory>
<outputDirectory>${tomcat-instance}/resources/mapper/</outputDirectory>
<includes>
<include>**/*</include>
</includes>
</fileSet>
</fileSets>
</assembly>
而且在Maven的配置有:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/resources/our-assembly.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
這CON構造程序集,但我擔心的是logback.xml
和mappers/our-mapper.xml
文件仍包含在war
內,其中包含assembly.tar.gz
。
是否有可能保持在戰爭外裝配包含.xml
文件,因爲它已經這樣做了配置,但也有去內組裝.tar.gz
總成,使他們不」排除這些相同的文件戰爭t在類路徑上出現兩次?
在此先感謝您的幫助。
謝謝。我可以看到這是一個潛在的選擇路徑。 – Cuga