maven-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "EJ Ciramella" <ejcirame...@upromise.com>
Subject RE: conditionally loading property files
Date Fri, 07 Apr 2006 16:40:13 GMT
So you have to know which filter you'd like to use?

Again - here's the scenario:

Currently with ant, we have three levels of property files
1 - default - found right next to the build.xml in the source directory, this configuration
will work for anyone right out of the box
2 - project level override - so for anyone who has a non-default installation of a 3rdparty
product (say someone wants to use a local database instead of the shared one for all of their
work).  These changes take precedence over the default set.  This file doesn't have to exist,
the <property file=""/> task in ant simply tries to load it.  If it doesn't exist, no
harm, no foul.
3 - branch level override - this one is for people testing say a new version of jboss.  So
for work in branch, these developers can adjust where these files are found without interfering
with any other branch work.

This has served us VERY well over the years (any company I work at, I try my hardest to implement
something like this right away).

I'm still not seeing how this works (or would work) in maven/maven 2.

With the example below, you have to have all the same properties in each profile.  With my
process outlined above, with each additional property file, there are fewer properties to
worry about.  This makes life a snap and (when properly used) there is NO redundancy.

Am I missing the boat or is there a way to do this in maven 2?

So far, I don't see how to do this.

-----Original Message-----
From: justin_fung@hsbc.ca [mailto:justin_fung@hsbc.ca] 
Sent: Friday, April 07, 2006 12:20 PM
To: Maven Users List
Subject: RE: conditionally loading property files

You can specify filter property files:

I set up 3 profiles in my pom.xml that allow me to define separate filter 
properties for each build I do to different environments

  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <includes>
                <include>datasource.properties</include>
        </includes>
        <filtering>true</filtering>
      </resource>
    </resources>
  </build>
  <profiles>
        <profile>
                <id>DEV</id>
                <build>
                    <finalName>DEV</finalName> 
                        <filters>
 <filter>src/main/filters/filters.DEV.properties</filter> 
                        </filters>
                </build>
        </profile>
        <profile>
                <id>SAT</id>
                <build>
                    <finalName>SAT</finalName> 
                        <filters>
 <filter>src/main/filters/filters.SAT.properties</filter> 
                        </filters>
                </build>
        </profile>
        <profile>
                <id>PRD</id>
                <build>
                    <finalName>PRD</finalName> 
                        <filters>
 <filter>src/main/filters/filters.PRD.properties</filter> 
                        </filters>
                </build>
        </profile> 
  </profiles>

-j

---------------------------------------------------
Justin Fung
justin_fung@hsbc.ca
Sr. Analyst, Business Systems
IT Banking Systems, e-Business
HSBC Bank Canada
http://www.hsbc.ca
p: (604) 643-6605
f: (604) 643-6727








"EJ Ciramella" <ejciramella@upromise.com>
04/07/2006 09:12 AM
Please respond to "Maven Users List"

 
        To:     "Maven Users List" <users@maven.apache.org>
        cc: 
        Subject:        RE: conditionally loading property files

      Our Ref: 
            Your Ref: 


So are people doing something like this?  What I want to avoid like the
plague is having a bunch of properties in the pom file in a profile.

If so, can anyone provide examples, or is this the wrong way to look at
this? 

-----Original Message-----
From: EJ Ciramella [mailto:ejciramella@upromise.com] 
Sent: Friday, April 07, 2006 11:02 AM
To: Maven Users List
Subject: RE: conditionally loading property files

Yeah, I tried this:

<settings>
<activeProfiles>
  <activeProfile>foxboro</activeProfile>
</activeProfiles>
  <profiles>
    <profile>
     <id>foxboro</id>
      <activation>
        <activeByDefault/>
      </activation>
      <properties>
       <db.port>9999</db.port>
      </properties>
    </profile>
  </profiles>
</settings>


But that port was never picked up.

What did I do wrong here? 

-----Original Message-----
From: dan tran [mailto:dantran@gmail.com] 
Sent: Friday, April 07, 2006 10:58 AM
To: Maven Users List
Subject: Re: conditionally loading property files

you can profile your resources ( never done it before thou )

http://maven.apache.org/guides/introduction/introduction-to-profiles.htm
l

-D


On 4/7/06, EJ Ciramella <ejciramella@upromise.com> wrote:
>
> sorry, drumming this up again guys - so I have the following:
>
>    <filters>
>       <filter>src/main/filters/filter.properties</filter>
>       <filter>${user.home}/${pom.name}.properties</filter>
>
> <filter>${user.home}/${pom.name}-${pom.version}.properties</filter>
>    </filters>
>
> But if a file doesn't exist, maven fails.  How can I make maven just
> continue if it doesn't exist instead of failing?
>
>

---------------------------------------------------------------------
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



 
*************************************************************** 
This email may contain confidential information, and is intended only for 
the named recipient and may be privileged.  Distribution or copying of 
this email by anyone other than the named recipient is prohibited. If you 
are not the named recipient, please notify us immediately and permanently 
destroy this email and all copies of it.  Internet email is not private, 
secure, or reliable.  No member of the HSBC Group is liable for any errors 
or omissions in the content or transmission of this email. Any opinions 
contained in this email are solely those of the author and, unless clearly 
indicated otherwise in writing, are not endorsed by any member of the HSBC 
Group. 
*************************************************************** 
Ce courriel peut renfermer des renseignements confidentiels et privilégiés 
et s'adresse au destinataire désigné seulement.   La distribution ou la 
copie de ce courriel par toute personne autre que le destinataire désigné 
est interdite.  Si vous n'êtes pas le destinataire désigné, veuillez nous 
en aviser immédiatement et détruire de façon permanente ce courriel ainsi 
que toute copie de celui-ci. La transmission de courriel par Internet ne 
constitue pas un mode de transmission confidentiel, sécuritaire ou fiable. 
 Aucun membre du Groupe HSBC ne sera responsable des erreurs ou des 
omissions relatives au contenu ou à la transmission de ce courriel. 
L'auteur de ce courriel est seul responsable des opinions émises dans ce 
courriel, lesquelles, à moins  d'un avis contraire fourni par écrit, ne 
sont pas endossées par aucun membre du Groupe HSBC. 
*************************************************************** 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Mime
View raw message