ant - Copy multiple files using maven-resources-plugin -
i'm trying
- delete/re-create directory
- copy arbitrary file directory
- copy multiple files directory each base directory of module in setup.
that said, there have 15 copy-paste operations in total. module called release
each other module. i've heard maven-resources-plugin there such purposes , tried utilize follows:
<plugins> <!-- use plugin remove install folder, re-created later--> <plugin> <artifactid>maven-clean-plugin</artifactid> <version>3.0.0</version> <configuration> <filesets> <fileset> <directory>${basedir}/module.release/install</directory> <followsymlinks>false</followsymlinks> </fileset> </filesets> </configuration> </plugin> <!-- plugin here used copy necessary files directories --> <plugin> <artifactid>maven-resources-plugin</artifactid> <version>3.0.1</version> <executions> <!-- create install folder --> <execution> <id>create-resources-1</id> <!-- possible?--> <phase>validate</phase> <goals> <goal>create-resources</goal> <!-- possible?--> </goals> <configuration> <resources> <resource> <directory>${basedir}/module.release/install</directory> </resource> </resources> </configuration> </execution> <!-- copy files install folder --> <execution> <id>copy-resources-1</id> <phase>validate</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputdirectory>${basedir}/module.release/install</outputdirectory> <resources> <resource> <directory>${basedir}/module.release/template</directory> <includes> <include> **/*.sh</include> <!-- wanted include .sh files found under directory--> </includes> <filtering>true</filtering> </resource> </resources> </configuration> </execution> <!-- copy felix file folder under install .--> <execution> <id>copy-resources-2</id> <phase>validate</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputdirectory>${basedir}/module.release/install/group1.broker/bin</outputdirectory> <resources> <resource> <directory>${basedir}/group1/org.apache.felix</directory> <includes> <include>felix.jar</include> </includes> <filtering>true</filtering> </resource> </resources> </configuration> </execution> <!-- copy template files , configurations --> <execution> <id>copy-resources-2</id> <phase>validate</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputdirectory>${basedir}/for-each-module/conf</outputdirectory> <!-- don't know each module's conf folder?--> <resources> <resource> <directory>${basedir}/module.release/template</directory> <includes> <include>**/*.properties</include> <!-- wanted include .properties files found under directory--> </includes> <filtering>true</filtering> </resource> </resources> </configuration> </execution> </executions> </plugin> </plugins>
however guess erroneous. looked bit , saw people define multiple executions not make sense in long run, since 15 executions in pom.xml
not feasible, or normal in such cases?
keep in mind told not use maven-antrun-plugin
or maven-assembly-plugin
. i've have ant code operation, , want mavenize this:
<!-- delete , create directory, make ready, put .sh files in there. --> <target name="clean"> <delete dir="${install.dir}" /> </target> <target name="prepare"> <mkdir dir="${install.dir}" /> <copy file="${template.dir}/run.all.sh" todir="${install.dir}" /> <copy file="${template.dir}/kill.all.sh" todir="${install.dir}" /> <copy file="${template.dir}/packlogs.sh" todir="${install.dir}" /> </target> <!-- copy felix binary bundle --> <copy file="../group1/org.apache.felix/felix.jar" todir="${component.release.dir}/bin" /> <!-- copy template files , configurations --> <copy file="${component.project.dir}/conf/config.properties" todir="${component.release.dir}/conf" /> <copy todir="${component.release.dir}/plans"> <fileset dir="${component.project.dir}/plans" includes="**" /> </copy> <copy file="../group1/module1.mw/conf/log4j.xml" todir="${component.release.dir}/conf" /> <copy file="${template.dir}/run.ant" todir="${component.release.dir}" /> <copy file="${template.dir}/run.sh" todir="${component.release.dir}" />
as can see file/folder operations. sure maven has convenient way of doing this. shouldn't more difficult ant one.
any thoughts?
Comments
Post a Comment