You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Ri...@barclayscapital.com on 2011/03/22 20:26:03 UTC

Defining common localRepository that will work on both Windows and linux

Hi,

My settings file in the .m2 folder begins like this-
<localRepository>C:\maven-repo\</localRepository>

I want to make this generic and define a common localRepository which will work both on Windows and on Linux. Please help.

Thanks,

Ritika Goel
Equities Connectivity and Futures
Barclays Capital
(212) 320-7356




_______________________________________________

This e-mail may contain information that is confidential, privileged or otherwise protected from disclosure. If you are not an intended recipient of this e-mail, do not duplicate or redistribute it by any means. Please delete it and any attachments and notify the sender that you have received it in error. Unless specifically indicated, this e-mail is not an offer to buy or sell or a solicitation to buy or sell any securities, investment products or other financial product or service, an official confirmation of any transaction, or an official statement of Barclays. Any views or opinions presented are solely those of the author and do not necessarily represent those of Barclays. This e-mail is subject to terms available at the following link: www.barcap.com/emaildisclaimer. By messaging with Barclays you consent to the foregoing.  Barclays Capital is the investment banking division of Barclays Bank PLC, a company registered in England (number 1026167) with its registered office at 1 Churchill Place, London, E14 5HP.  This email may relate to or be sent from other members of the Barclays Group.
_______________________________________________

Re: Defining common localRepository that will work on both Windows and linux

Posted by Baptiste MATHUS <ml...@batmat.net>.
Another simple solution we use: define environment variable, and set value
accordingly.
<localRepository>${env.M2_REPO}</localRepository>

Then just set this env variable correctly, depending on the system it's
running on. But the settings.xml can always be the same.

We use this technique to be able to have the same settings.xml between
developers using Windows and the CI server under Unix.

Cheers

2011/3/22 Wayne Fay <wa...@gmail.com>

> > My settings file in the .m2 folder begins like this-
> > <localRepository>C:\maven-repo\</localRepository>
> >
> > I want to make this generic and define a common localRepository which
> will
> > work both on Windows and on Linux. Please help.
>
> If you drop the C:\ and just specify a path, it will be common to both
> Windows and Linux. I am pretty sure Windows uses the SystemDrive
> property (type "set" in MSDOS to see the value) to decide which drive
> the path is located on, so hopefully all your Windows users have that
> value the same.
>
> For example:
> <localRepository>/maven-repo/</localRepository>
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>


-- 
Baptiste <Batmat> MATHUS - http://batmat.net
Sauvez un arbre,
Mangez un castor !

Re: Defining common localRepository that will work on both Windows and linux

Posted by Wayne Fay <wa...@gmail.com>.
> My settings file in the .m2 folder begins like this-
> <localRepository>C:\maven-repo\</localRepository>
>
> I want to make this generic and define a common localRepository which will
> work both on Windows and on Linux. Please help.

If you drop the C:\ and just specify a path, it will be common to both
Windows and Linux. I am pretty sure Windows uses the SystemDrive
property (type "set" in MSDOS to see the value) to decide which drive
the path is located on, so hopefully all your Windows users have that
value the same.

For example:
<localRepository>/maven-repo/</localRepository>

Wayne

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


Re: Defining common localRepository that will work on both Windows and linux

Posted by Marc Rohlfs <po...@googlemail.com>.
As Windows und Unix have a different file system structures, I'd say 
you'll need to work with properties. Call 'mvn help:system' on both 
systems and try to find a common property (either system property or 
environment variable) You could use. The Maven Properties Guide [1] 
gives some further information about available properties. You could 
either define a custom environment variable on each workstation and use 
that one.
Some examples how You could define the local repositories using a property:
<localRepository>${user.home}/.m2/repository</localRepository>
<localRepository>${env.HOME}/.m2/repository</localRepository>
<localRepository>${env.CUSTOM_REPO_ENV_VAR}</localRepository>


[1] http://docs.codehaus.org/display/MAVENUSER/MavenPropertiesGuide

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