Including another xml file in pom.xml
I am trying to include an XML file in a . Mine looks something like this pom.xml (maven)
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>
I am using for . But I have saved the css and js files in many separate folders. I need to add this tag below "com.samaxes.maven"
minify css and js files
<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>
I have the option to include multiple directories, and I decided to include all directories by repeating the snippet code above. But later, to separate all the mifiy, include in another XML file. I am looking for a way to include an XML tag inside a tag. Someone please help me.
source to share
I think this is not how maven should be used.
what you can do is create a parent pom.xml with all global plugin config inside the pluginManagement section. then you can activate customized execution with id "default-minify-1" in all your child pom.xml. but the config is done only once in the parent pom.xml
source to share