I know how to do the filtering:
processResources {
filter ReplaceTokens, tokens: [
queryUrl: "http://com.myapp-dev/query",
moduleUrl: "http://com.myapp-dev/module"
]
}
But then I might have a different set of values for a different situation:
processResources {
filter ReplaceTokens, tokens: [
queryUrl: "http://com.myapp-test/query",
moduleUrl: "http://com.myapp-test/module"
]
}
These represent two different profiles. Where can I define a profile and
activate it? Is there something in the documentation I have missed?
Thanks.
-----Original Message-----
From: Jason Porter [mailto:[email protected]]
Sent: Monday, February 07, 2011 3:24 PM
To: [email protected]
Subject: Re: [gradle-user] Simulating Maven Profiles
On Mon, Feb 7, 2011 at 13:02, Neil Chaudhuri
<[email protected]> wrote:
> Consider the following in a Spring context file:
>
> <bean id="myBean" class="com.myapp.MyBean">
> <property name="queryUrl" value="@queryUrl@"/>
> <property name="moduleUrl" value="@moduleUrl@"/>
> </bean>
>
> Consider a Maven profile "dev" which applies "http://com.myapp-dev/query" for
> the queryUrl variable and "http://com.myapp-dev/module" for the moduleUrl
> variable when activated.
> Consider a Maven profile "test" which applies "http://com.myapp-test/query"
> for the queryUrl variable and "http://com.myapp-test/module" for the
> moduleUrl variable when activated.
I may be over simplifying this, but it looks like a simple replacement
filter. You just need some way of getting the values for the
replacement, correct? If that's the case you do this as a rule and
load up the appropriate properties file (or set the values) in the
rule.
>
> How could I do this in Gradle? Let me know if you need further clarification.
>
> Thanks.
>
>
> -----Original Message-----
> From: Jason Porter [mailto:[email protected]]
> Sent: Monday, February 07, 2011 2:52 PM
> To: [email protected]
> Subject: Re: [gradle-user] Simulating Maven Profiles
>
> On Mon, Feb 7, 2011 at 12:34, Neil Chaudhuri
> <[email protected]> wrote:
>> Fair point, Jason. All I'm doing at the moment is interpolating variables in
>> resource files based on the profile applied. Of course, there may be other
>> things I want to try in the future, but for now do you have any suggestions
>> for cleanly interpolating variables by profile?
>
> Could you provide an example please? Trying to do this context switch
> (along with all the other work stuff I have going on) isn't proving
> easy.
>
>> Thanks.
>>
>>
>> -----Original Message-----
>> From: Jason Porter [mailto:[email protected]]
>> Sent: Monday, February 07, 2011 2:27 PM
>> To: [email protected]
>> Subject: Re: [gradle-user] Simulating Maven Profiles
>>
>> On Mon, Feb 7, 2011 at 12:22, Neil Chaudhuri
>> <[email protected]> wrote:
>>> As I transition from Maven to Gradle, I am curious about how to implement
>>> Maven’s profile mechanism in Gradle. I have found few resources on the
>>> topic, and the one that seems the most compelling—calling applyFrom on a
>>> script whose name is provided at build time from the command line—doesn’t
>>> strike me as optimal. While clever, it seems a bit like an anti-pattern.
>>>
>>>
>>>
>>> Any thoughts on best practices or other insights into simulating Maven
>>> profiles is appreciated.
>>
>> It may actually depend on what you want to do with them. Modifying
>> deps I've done something very similar based on the DAG containing
>> tasks and modifying at that point, adding plugins, not exactly sure.
>>
>>>
>>>
>>> Thanks.
>>>
>>>
>>
>>
>>
>> --
>> Jason Porter
>> http://lightguard-jp.blogspot.com
>> http://twitter.com/lightguardjp
>>
>> Software Engineer
>> Open Source Advocate
>>
>> PGP key id: 926CCFF5
>> PGP key available at: keyserver.net, pgp.mit.edu
>>
>> ---------------------------------------------------------------------
>> To unsubscribe from this list, please visit:
>>
>> http://xircles.codehaus.org/manage_email
>>
>>
>>
>
>
>
> --
> Jason Porter
> http://lightguard-jp.blogspot.com
> http://twitter.com/lightguardjp
>
> Software Engineer
> Open Source Advocate
>
> PGP key id: 926CCFF5
> PGP key available at: keyserver.net, pgp.mit.edu
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
> http://xircles.codehaus.org/manage_email
>
>
>
--
Jason Porter
http://lightguard-jp.blogspot.com
http://twitter.com/lightguardjp
Software Engineer
Open Source Advocate
PGP key id: 926CCFF5
PGP key available at: keyserver.net, pgp.mit.edu
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email