You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Kalle Korhonen <ka...@gmail.com> on 2007/04/04 21:53:26 UTC

Re: How to manage enviroments & repositories whit Maven 2 ?

I haven't used, and documentation is scarce as always, but couldn't you use
the artifact's classifier element for this? So, basically your option b),
but use either develop, integration, test or production as the artifact
classifier. More at least here:
http://docs.codehaus.org/display/MAVENUSER/Improving+Maven2+Dependency+Resolution.
Probably requires some googling from your part, but I recall seeing it in
use at least in one case.

Kalle

On 4/4/07, kstore69 <ks...@tiscali.it> wrote:
>
> Hi,
> I'm uncertain how to deal whit the following scenario,
> and I would like to know if someone has already dealt with and how.
>
> We got four environment, develop, integration, test and production.
> There is a J2EE web app, with a .war, .ear and other jar archives.
>
> Now, the .war has properties which depend from the environment (db user
> name, db ip address, MQ setting ... and many others). Using the
> filtering & profile features of Maven, we can successfully build the
> right artifact with the right properties for the right environment.
>
> The Ear pom.xml file has the reference to the war as:
>
> <project ...
> <plugin>
> <artifactId>maven-ear-plugin</artifactId>
>   <configuration>
> <modules>
> <webModule>
>    <groupId>it.mycompany.xxx</groupId>
>     <artifactId>myApp-war</artifactId>
>     <contextRoot>/</contextRoot>
>    </webModule>
>
> ....
>
> <dependencies>
>          <dependency>
>           <groupId>it.mycompany.xxx</groupId>
>     <artifactId>myApp-war</artifactId>
>              <version>1.54.0.0</version>
>              <type>war</type>
>          </dependency>
>      </dependencies>
> ... </project>
>
> The question is: how do I know if myApp-war-1.54.0.0 in the repository,
> at the time that I'm executing the ear pom.xml is the develop, the
> integration, the test or the production one ?
>
> So, we look at two solution:
>
> a) set up an internal repository for each environment and define the
> profiles in the settings.xml.
> The develop profile sets the address of the develop-rep as repository to
> get ant deploy the artifacts, same as for the integration one, test and
> production. So we got N repositories, depending of the number of the
> environment, and the other standard reps (codehaus, snapshoot, plugin
> etc ..).
>
> -->> Running the parent pom with: "mvn -PIntegration deploy" will deploy
> the war-1.54.0.0. and the ear-1.54.0.0 in the Integration-rep.
>
>
> b) use different artifacts name, both in the artifact definition tag and
> in the dependencies one, like:
>
> war pom.xml
> <groupId>it.mycompany.xxx</groupId>
>     <artifactId>myApp-war${enviroment.name}</artifactId>
>       <version>1.54.0.0</version>
>      <packaging>war</packaging>
>
> and then same in the ear pom.xml
> <plugin>
> <artifactId>maven-ear-plugin</artifactId>
> <configuration>
> <modules>
> <webModule>
>    <groupId>it.mycompany.xxx</groupId>
>     <artifactId>myApp-war${environment.name}</artifactId>
>     <contextRoot>/</contextRoot>
>    </webModule>
>
> <dependencies>
>          <dependency>
>           <groupId>it.mycompany.xxx</groupId>
>          <artifactId>myApp-war${environment.name}</artifactId>
>              <version>1.54.0.0</version>
>              <type>war</type>
>          </dependency>
>      </dependencies>
>
> where the properties ${environment.name} is defined in the profile.
> -->> Running the parent pom with: mvn -PIntegration deploy will deploy
> the war-integration-1.54.0.0  and the ear-integration-1.54.0.0  in the
> default rep.
>
> Any suggestion or experience with these scenarios ? Which one should be
> the right one? Are there any blue prints for this ?
>
> Regards
> Mauro
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>