iterator-maven-plugin icon indicating copy to clipboard operation
iterator-maven-plugin copied to clipboard

Set different properties for filtering during iteraotor

Open exotfboy opened this issue 9 years ago • 2 comments

pom.xml:

<plugin>
    <groupId>com.soebes.maven.plugins</groupId>
    <artifactId>iterator-maven-plugin</artifactId>
    <version>0.3</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>iterator</goal>
            </goals>
            <configuration>
                <items>
                    <item>dev</item>
                    <item>prod1</item>
                    <item>prod2</item>
                </items>
                <pluginExecutors>
                    <pluginExecutor>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-assembly-plugin</artifactId>
                            <version>2.6</version>
                        </plugin>
                        <goal>single</goal>
                        <configuration>
                            <delimiters>
                                <delimiter>@</delimiter>
                            </delimiters>
                            <descriptors>
                                <descriptor>${project.basedir}/src/main/assembly/common.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </pluginExecutor>
                </pluginExecutors>
            </configuration>
        </execution>
    </executions>
</plugin>

When assembly different packages, I need filter some properties for the resources file, and I do not want to specified different properties files, I wonder if I can set accordingly properties during each iterator?

assembly file:

<assembly
        xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">

    <id>${item}</id>
    <formats>
        <format>war</format>
    </formats>
    <includeBaseDirectory>false</includeBaseDirectory>
    <fileSets>
        <fileSet>
            <directory>${basedir}/target/${project.build.finalName}-spring</directory>
            <outputDirectory>/</outputDirectory>
            <includes>
                <include>**/*</include>
            </includes>
            <excludes>
                <exclude>**/application.yaml</exclude>
            </excludes>
        </fileSet>
    </fileSets>
    <files>
        <file>
            <source>${basedir}/src/main/resources/application.yaml</source>
            <outputDirectory>/WEB-INF/classes</outputDirectory>
            <filtered>true</filtered>
        </file>
    </files>
</assembly>

exotfboy avatar Dec 29 '15 02:12 exotfboy

To be honest i don't understand your question...can you make a full working example (best a github project) which works and you explain what you like to happen...

khmarbaise avatar Apr 26 '16 20:04 khmarbaise

Even though the initial question was asked quite some time ago, I have a similar interest.

In my case, I would be interested in a solution that would be using the <folder> configuration element and the <itemsWithProperties> one with the latter loading the properties from a file in the sub-folders. In other words, I would like to have the iterator-maven-plugin configured somewhat as the example below:

<plugin>
    <groupId>com.soebes.maven.plugins</groupId>
    <artifactId>iterator-maven-plugin</artifactId>
    <version>0.3</version>
    <executions>
        <execution>
            <phase>package</phase>
            <goals>
                <goal>iterator</goal>
            </goals>
            <configuration>
                  <folder>src/main/java/com/soebes/maven/multiple/</folder>
                  <itemsWithProperties fromItemFile="my-item.properties" />

                <pluginExecutors>
                    <pluginExecutor>
                         [...]
                    </pluginExecutor>
                </pluginExecutors>
            </configuration>
        </execution>
    </executions>
</plugin>

Is there already a way already allowing such behaviors with the current version of iterator-maven-plugin?

Ceddaerrix avatar Mar 21 '23 14:03 Ceddaerrix