Eike Stepper wrote:
sorry, just solved it myself:

criteria.put("merlin.repository", System.getProperty("user.home") + "/.maven/repository");

That will work in some scenarios but will break if the user has defined a MAVEN_HOME_LOCAL environment variable. A better option would be to do something like the following (pulled from merlin unit):


    private static File getMavenHome()
    {
        try
        {
            String local =
              System.getProperty(
                "maven.home.local",
                Env.getEnvVariable( "MAVEN_HOME_LOCAL" ) );

            if( null != local )
               return new File( local ).getCanonicalFile();

            return new File(
              System.getProperty( "user.home" )
              + File.separator
              + ".maven" ).getCanonicalFile();

        }
        catch( Throwable e )
        {
            final String error =
              "Internal error while attempting to access environment.";
            final String message =
              ExceptionHelper.packException( error, e, true );
            throw new RuntimeException( message );
        }
    }

Cheers, Stephen.


--

|---------------------------------------|
| Magic by Merlin                       |
| Production by Avalon                  |
|                                       |
| http://avalon.apache.org              |
|---------------------------------------|

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to