Quantcast

How to rename or copy resource files when packaging war-file

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to rename or copy resource files when packaging war-file

Johan Hammar
Hi!

In my project I have two files, foo-dev.xml and foo-production.xml, in
src/main/resources. When I package the project as a war-file I want to
rename or copy one of those files to foo.xml. Which file to rename or
copy depends on which profile I run maven with. Is this possible and
where can I learn more about this?

Regards,
Johan Hammar

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to rename or copy resource files when packaging war-file

Michael McCallum
why not externalise - as in not in the war - the configuration? because by
inferrence you are talking about rebuilding your war file for different
environments... how do you guarantee that its the same without a bunch of
extra hassle?


On Fri, 10 Oct 2008 03:27:04 Johan Hammar wrote:

> Hi!
>
> In my project I have two files, foo-dev.xml and foo-production.xml, in
> src/main/resources. When I package the project as a war-file I want to
> rename or copy one of those files to foo.xml. Which file to rename or
> copy depends on which profile I run maven with. Is this possible and
> where can I learn more about this?
>
> Regards,
> Johan Hammar
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]



--
Michael McCallum
Enterprise Engineer
mailto:[hidden email]

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to rename or copy resource files when packaging war-file

Johan Hammar
Yes, that is of course the best solution, however our way of doing it
is just temporary until we get some other stuff sorted out. I'm still
interested if it is possible or not.

Thanks,
Johan

On Thu, Oct 9, 2008 at 8:56 PM, Michael McCallum <[hidden email]> wrote:

> why not externalise - as in not in the war - the configuration? because by
> inferrence you are talking about rebuilding your war file for different
> environments... how do you guarantee that its the same without a bunch of
> extra hassle?
>
>
> On Fri, 10 Oct 2008 03:27:04 Johan Hammar wrote:
>> Hi!
>>
>> In my project I have two files, foo-dev.xml and foo-production.xml, in
>> src/main/resources. When I package the project as a war-file I want to
>> rename or copy one of those files to foo.xml. Which file to rename or
>> copy depends on which profile I run maven with. Is this possible and
>> where can I learn more about this?
>>
>> Regards,
>> Johan Hammar
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>
>
>
> --
> Michael McCallum
> Enterprise Engineer
> mailto:[hidden email]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: How to rename or copy resource files when packaging war-file

Stephen Coy
In reply to this post by Johan Hammar
I agree with the other guys in that it is way better to externalise  
your configuration.

In the meantime, it is probably easier to put each foo.xml in  
different directories, say src/main/resources-prod and src/main/
resources-dev. Then use profiles to select different build  
configurations. Refer to <http://maven.apache.org/plugins/maven-resources-plugin/ 
 > for information on how to do resources configuration.

Alternatively, you could use the same foo.xml and filter copy it,  
specifying the property values to be substituted in profiles instead.

Cheers

On 10/10/2008, at 1:27 AM, Johan Hammar wrote:

> Hi!
>
> In my project I have two files, foo-dev.xml and foo-production.xml, in
> src/main/resources. When I package the project as a war-file I want to
> rename or copy one of those files to foo.xml. Which file to rename or
> copy depends on which profile I run maven with. Is this possible and
> where can I learn more about this?
>
> Regards,
> Johan Hammar
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...