【发布时间】:2015-01-20 21:54:43
【问题描述】:
我正在尝试在 pom.xml (maven) 中包含 xml 文件。
我的 pom.xml 看起来有点像这个
<?xml version="1.0" encoding="UTF-8"?>
<project>
<!-- <xi:include href="minify.xml" xmlns:xi="http://www.w3.org/2003/XInclude"/>
--> <modelVersion>4.0.0</modelVersion>
<groupId>myproject</groupId>
<artifactId>myproject</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<description></description>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<!-- include plugin tag from other xml file -->
// I would like maintain one seperate xml file to hold all plugin tags (to reduce pom.xml //file content.
</plugins>
我正在使用 "com.samaxes.maven" 到 minify css and js files 。
但我将我的 css 和 js 文件保存在许多单独的文件夹中。我需要在下面重复包含这个标签
<plugin>
<groupId>com.samaxes.maven</groupId>
<artifactId>minify-maven-plugin</artifactId>
<version>1.7.4</version>
<executions>
<execution>
<id>default-minify-1</id>
<configuration>
<charset>utf-8</charset>
<jsEngine>CLOSURE</jsEngine>
<skipMerge>true</skipMerge>
<nosuffix>true</nosuffix>
<!-- <skipMinify>true</skipMinify> --> <!--skips already minfied css fiels -->
<cssSourceDir>inc/one/css</cssSourceDir>
<cssTargetDir>inc/one/css/mini</cssTargetDir>
<cssSourceIncludes>
<cssSourceInclude>*.css</cssSourceInclude>
</cssSourceIncludes>
<jsSourceDir>proj/platform/common/js/</jsSourceDir>
<jsTargetDir>proj/platform/common/js/mini</jsTargetDir>
<jsSourceIncludes>
<jsSourceInclude>*.js</jsSourceInclude>
</jsSourceIncludes>
<closureCreateSourceMap>true</closureCreateSourceMap>
</configuration>
<goals>
<goal>minify</goal>
</goals>
</execution>
</executions>
</plugin>
我搜索了包含多个目录的可能方法,然后我决定通过重复上面的 sn-p 代码来包含所有目录。但后来虽然将所有 mifiy 包含到其他 xml 文件中。我正在寻找某种方法来在 tag 中包含 xml 文件。 有人请帮帮我。
【问题讨论】: