You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Geir Gullestad Pettersen <ge...@gmail.com> on 2007/06/15 11:29:23 UTC
Copy file
Is there a plugin to copy a specified file during the build process?
In src/main/resources I have "config-customer1.xml", "config-customer2.xml",
"...3" and so on.. Depending on which profile I activate when running Maven
I need one of these files to be copied to "src/main/resources/config.xml" so
that the correct config for the given customer is used. Is that possible?
Re: Copy file
Posted by Stephen Coy <st...@resolvesw.com>.
Hi,
There's a couple of approaches to this:
1) use separate resources directories for each customer, with each
one containing a config.xml. Then configure a resources block in each
profile that points at the appropriate directory.
2) use a single config file that has its values specified as property
values (using ${property.name} notation. Specify the property values
in each profile and configure the main resources block to use filter
copying.
Cheers,
Steve Coy
On 15/06/2007, at 7:29 PM, Geir Gullestad Pettersen wrote:
> Is there a plugin to copy a specified file during the build process?
>
> In src/main/resources I have "config-customer1.xml", "config-
> customer2.xml",
> "...3" and so on.. Depending on which profile I activate when
> running Maven
> I need one of these files to be copied to "src/main/resources/
> config.xml" so
> that the correct config for the given customer is used. Is that
> possible?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Copy file
Posted by Thorsten Heit <th...@gmx.de>.
Hi,
> Is there a plugin to copy a specified file during the build process?
>
> In src/main/resources I have "config-customer1.xml",
> "config-customer2.xml",
> "...3" and so on.. Depending on which profile I activate when running
> Maven
> I need one of these files to be copied to "src/main/resources/config.xml"
> so
> that the correct config for the given customer is used. Is that possible?
What about the antrun plugin? It should allow you to do what you want...
HTH
Thorsten
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Copy file
Posted by Maria Odea Ching <oc...@exist.com>.
In each of your profiles, you could define a separate <build> block
which contains which resources you want to be included in each profile
(using the <includes> and <excludes> tags).
You may want to take a look at this..
http://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html
-Deng
Geir Gullestad Pettersen wrote:
> Is there a plugin to copy a specified file during the build process?
>
> In src/main/resources I have "config-customer1.xml",
> "config-customer2.xml",
> "...3" and so on.. Depending on which profile I activate when running
> Maven
> I need one of these files to be copied to
> "src/main/resources/config.xml" so
> that the correct config for the given customer is used. Is that possible?
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Copy file
Posted by Nathan Maves <na...@gmail.com>.
I think the following solution should work for you.
Here are two example profiles
<profile>
<id>env-qa</id>
<activation>
<property>
<name>env</name>
<value>qa</value>
</property>
</activation>
<properties>
<env>qa</env>
</properties>
</profile>
<profile>
<id>env-prod</id>
<activation>
<property>
<name>env</name>
<value>prod</value>
</property>
</activation>
<properties>
<env>prod</env>
</properties>
</profile>
and here are my resouces
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/resources-${env}</directory>
</resource>
</resources>
and your directory structure would look like....
/src/main
/resources
/resources-qa
/resources-prod
place any env specific files in the qa or prod directories
then build via profile
mvn package -p env-prod
or by env var
mvn package -Denv=prod
Hope this helps
Nathan
On 6/28/07, Manos Batsis <ma...@geekologue.com> wrote:
>
>
> AFAIK this can only be done with the antrun plugin.
>
> Ahmet Aytekin wrote:
> > Hi,
> >
> > Did you find an answer for your problem below? I am trying to do the
> > same thing here. I 'd appreciate it if anyone can answer this.
> >
> > Regards,
> >
> >
> >
> >
> > geirgp wrote:
> >> Thanks for replying, but I can't see how configuring this plugin can
> >> help me
> >> copy a file during the process-sources phase. What I need is something
> >> that
> >> copies "config-customer1.xml" to "config.xml", and as far as I can see
> >> this
> >> plugin only handles inclusion/exclusion of files within a resource
> >> directory.
> >>
> >>
> >> Maria Odea Ching-2 wrote:
> >>
> >>> In each of your profiles, you could define a separate <build> block
> >>> which contains which resources you want to be included in each
> >>> profile (using the <includes> and <excludes> tags).
> >>>
> >>> You may want to take a look at this..
> >>>
> http://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html
> >>>
> >>>
> >>> Btw, the resources:resources goal of the maven-resources-plugin is
> >>> already bound to Maven's process-resources phase so when you do' mvn
> >>> install', its already executed.. you need not execute 'mvn
> >>> resources:resources'.
> >>>
> >>> -Deng
> >>>
> >>> Geir Gullestad Pettersen wrote:
> >>>
> >>>> Is there a plugin to copy a specified file during the build process?
> >>>>
> >>>> In src/main/resources I have "config-customer1.xml",
> >>>> "config-customer2.xml",
> >>>> "...3" and so on.. Depending on which profile I activate when
> >>>> running Maven
> >>>> I need one of these files to be copied to
> >>>> "src/main/resources/config.xml" so
> >>>> that the correct config for the given customer is used. Is that
> >>>> possible?
> >>>>
> >>>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>> For additional commands, e-mail: users-help@maven.apache.org
> >>>
> >>>
> >>>
> >>>
> >>
> >>
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: Copy file
Posted by Manos Batsis <ma...@geekologue.com>.
AFAIK this can only be done with the antrun plugin.
Ahmet Aytekin wrote:
> Hi,
>
> Did you find an answer for your problem below? I am trying to do the
> same thing here. I 'd appreciate it if anyone can answer this.
>
> Regards,
>
>
>
>
> geirgp wrote:
>> Thanks for replying, but I can't see how configuring this plugin can
>> help me
>> copy a file during the process-sources phase. What I need is something
>> that
>> copies "config-customer1.xml" to "config.xml", and as far as I can see
>> this
>> plugin only handles inclusion/exclusion of files within a resource
>> directory.
>>
>>
>> Maria Odea Ching-2 wrote:
>>
>>> In each of your profiles, you could define a separate <build> block
>>> which contains which resources you want to be included in each
>>> profile (using the <includes> and <excludes> tags).
>>>
>>> You may want to take a look at this..
>>> http://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html
>>>
>>>
>>> Btw, the resources:resources goal of the maven-resources-plugin is
>>> already bound to Maven's process-resources phase so when you do' mvn
>>> install', its already executed.. you need not execute 'mvn
>>> resources:resources'.
>>>
>>> -Deng
>>>
>>> Geir Gullestad Pettersen wrote:
>>>
>>>> Is there a plugin to copy a specified file during the build process?
>>>>
>>>> In src/main/resources I have "config-customer1.xml",
>>>> "config-customer2.xml",
>>>> "...3" and so on.. Depending on which profile I activate when
>>>> running Maven
>>>> I need one of these files to be copied to
>>>> "src/main/resources/config.xml" so
>>>> that the correct config for the given customer is used. Is that
>>>> possible?
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>>
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Copy file
Posted by geirgp <ge...@gmail.com>.
Hi,
No, I have not found the answer yet. I actually worked around the problem
and changed the application so that the config file can be deployed at
runtime, a solution I found to be more flexible as it does not require a
full rebuild.
Ahmet Aytekin wrote:
>
> Hi,
>
> Did you find an answer for your problem below? I am trying to do the
> same thing here. I 'd appreciate it if anyone can answer this.
>
> Regards,
>
>
>
>
> geirgp wrote:
>> Thanks for replying, but I can't see how configuring this plugin can help
>> me
>> copy a file during the process-sources phase. What I need is something
>> that
>> copies "config-customer1.xml" to "config.xml", and as far as I can see
>> this
>> plugin only handles inclusion/exclusion of files within a resource
>> directory.
>>
>>
>>
>> Maria Odea Ching-2 wrote:
>>
>>> In each of your profiles, you could define a separate <build> block
>>> which contains which resources you want to be included in each profile
>>> (using the <includes> and <excludes> tags).
>>>
>>> You may want to take a look at this..
>>> http://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html
>>>
>>> Btw, the resources:resources goal of the maven-resources-plugin is
>>> already bound to Maven's process-resources phase so when you do' mvn
>>> install', its already executed.. you need not execute 'mvn
>>> resources:resources'.
>>>
>>> -Deng
>>>
>>> Geir Gullestad Pettersen wrote:
>>>
>>>> Is there a plugin to copy a specified file during the build process?
>>>>
>>>> In src/main/resources I have "config-customer1.xml",
>>>> "config-customer2.xml",
>>>> "...3" and so on.. Depending on which profile I activate when running
>>>> Maven
>>>> I need one of these files to be copied to
>>>> "src/main/resources/config.xml" so
>>>> that the correct config for the given customer is used. Is that
>>>> possible?
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>
>>>
>>
>>
>
>
--
View this message in context: http://www.nabble.com/Copy-file-tf3926772s177.html#a11367687
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Copy file
Posted by Ahmet Aytekin <aa...@gmail.com>.
Hi,
Did you find an answer for your problem below? I am trying to do the
same thing here. I 'd appreciate it if anyone can answer this.
Regards,
geirgp wrote:
> Thanks for replying, but I can't see how configuring this plugin can help me
> copy a file during the process-sources phase. What I need is something that
> copies "config-customer1.xml" to "config.xml", and as far as I can see this
> plugin only handles inclusion/exclusion of files within a resource
> directory.
>
>
>
> Maria Odea Ching-2 wrote:
>
>> In each of your profiles, you could define a separate <build> block
>> which contains which resources you want to be included in each profile
>> (using the <includes> and <excludes> tags).
>>
>> You may want to take a look at this..
>> http://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html
>>
>> Btw, the resources:resources goal of the maven-resources-plugin is
>> already bound to Maven's process-resources phase so when you do' mvn
>> install', its already executed.. you need not execute 'mvn
>> resources:resources'.
>>
>> -Deng
>>
>> Geir Gullestad Pettersen wrote:
>>
>>> Is there a plugin to copy a specified file during the build process?
>>>
>>> In src/main/resources I have "config-customer1.xml",
>>> "config-customer2.xml",
>>> "...3" and so on.. Depending on which profile I activate when running
>>> Maven
>>> I need one of these files to be copied to
>>> "src/main/resources/config.xml" so
>>> that the correct config for the given customer is used. Is that possible?
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>>
>
>
Re: Copy file
Posted by Maria Odea Ching <oc...@exist.com>.
Hi,
Sorry, I misread your previous email. I thought it was about using a
different config file for every profile.
Anyway, I don't know of any plugin that can be used for what you wanted
to do..
-Deng
geirgp wrote:
> Thanks for replying, but I can't see how configuring this plugin can help me
> copy a file during the process-sources phase. What I need is something that
> copies "config-customer1.xml" to "config.xml", and as far as I can see this
> plugin only handles inclusion/exclusion of files within a resource
> directory.
>
>
>
> Maria Odea Ching-2 wrote:
>
>> In each of your profiles, you could define a separate <build> block
>> which contains which resources you want to be included in each profile
>> (using the <includes> and <excludes> tags).
>>
>> You may want to take a look at this..
>> http://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html
>>
>> Btw, the resources:resources goal of the maven-resources-plugin is
>> already bound to Maven's process-resources phase so when you do' mvn
>> install', its already executed.. you need not execute 'mvn
>> resources:resources'.
>>
>> -Deng
>>
>> Geir Gullestad Pettersen wrote:
>>
>>> Is there a plugin to copy a specified file during the build process?
>>>
>>> In src/main/resources I have "config-customer1.xml",
>>> "config-customer2.xml",
>>> "...3" and so on.. Depending on which profile I activate when running
>>> Maven
>>> I need one of these files to be copied to
>>> "src/main/resources/config.xml" so
>>> that the correct config for the given customer is used. Is that possible?
>>>
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>>
>>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Copy file
Posted by geirgp <ge...@gmail.com>.
Thanks for replying, but I can't see how configuring this plugin can help me
copy a file during the process-sources phase. What I need is something that
copies "config-customer1.xml" to "config.xml", and as far as I can see this
plugin only handles inclusion/exclusion of files within a resource
directory.
Maria Odea Ching-2 wrote:
>
> In each of your profiles, you could define a separate <build> block
> which contains which resources you want to be included in each profile
> (using the <includes> and <excludes> tags).
>
> You may want to take a look at this..
> http://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html
>
> Btw, the resources:resources goal of the maven-resources-plugin is
> already bound to Maven's process-resources phase so when you do' mvn
> install', its already executed.. you need not execute 'mvn
> resources:resources'.
>
> -Deng
>
> Geir Gullestad Pettersen wrote:
>> Is there a plugin to copy a specified file during the build process?
>>
>> In src/main/resources I have "config-customer1.xml",
>> "config-customer2.xml",
>> "...3" and so on.. Depending on which profile I activate when running
>> Maven
>> I need one of these files to be copied to
>> "src/main/resources/config.xml" so
>> that the correct config for the given customer is used. Is that possible?
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
>
--
View this message in context: http://www.nabble.com/Copy-file-tf3926772s177.html#a11168077
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Copy file
Posted by Maria Odea Ching <oc...@exist.com>.
In each of your profiles, you could define a separate <build> block
which contains which resources you want to be included in each profile
(using the <includes> and <excludes> tags).
You may want to take a look at this..
http://maven.apache.org/plugins/maven-resources-plugin/examples/include-exclude.html
Btw, the resources:resources goal of the maven-resources-plugin is
already bound to Maven's process-resources phase so when you do' mvn
install', its already executed.. you need not execute 'mvn
resources:resources'.
-Deng
Geir Gullestad Pettersen wrote:
> Is there a plugin to copy a specified file during the build process?
>
> In src/main/resources I have "config-customer1.xml",
> "config-customer2.xml",
> "...3" and so on.. Depending on which profile I activate when running
> Maven
> I need one of these files to be copied to
> "src/main/resources/config.xml" so
> that the correct config for the given customer is used. Is that possible?
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org