You are viewing a plain text version of this content. The canonical link for it is here.
Posted to nmaven-dev@incubator.apache.org by "Deacon, Brian" <Br...@intuit.com> on 2007/06/14 23:34:59 UTC

How is SettingsGeneratorMojo passed through?

I'm trying to suss out a solution to the problem of
SettingsGeneratorMojo.cs getting lost if "HOMEPATH" doesn't point it to
the same place as java's user.home property.  (Jira issue 79)

It would seem that SettingsGeneratorMojo.java is a bucket for these
types of values, and would like something like this:

public String getM2UserHome()
{
  return System.getProperty("user.home") + File.separator + ".m2";
}

Since it is System.getProperty("user.home") that ultimately dictates
where the .m2 directory is.

I -think- 
Environment.GetEnvironmentVariable("USERPROFILE") 
is always available and we should use that over
Environment.GetEnvironmentVariable("SystemDrive") +
Environment.GetEnvironmentVariable("HOMEPATH")

But I think bestest would be for the java side to explicitly hand over
the value through something like the getM2UserHome property I propose
above.  But I can't seem to see where SettingsGeneratorMojo.java ever
gets called to pass those values along to the .Net side, if it even
does.  Can anyone point me in the right direction?

Meanwhile still trying to get eclipse to bend to my will...

B

RE: How is SettingsGeneratorMojo passed through?

Posted by "Deacon, Brian" <Br...@intuit.com>.
I might be off base here, but isn't there a distinction between the
repository location and the user's .m2 directory?

What we're really looking for is the location of nmaven-settings.xml,
which is dictated by System.getProperty("user.home") from java.

Does ${settings.localRepository} map to "~/.m2/repository/" or "~/.m2/"?

I would guess it maps to ~/.m2/repository, and can't the repository
location be arbitrarily modified?  I don't think we can assume
${settings.localRepository}/../nmaven-settings.xml

Brian

-----Original Message-----
From: Shane Isbell [mailto:shane.isbell@gmail.com] 
Sent: Thursday, June 14, 2007 6:29 PM
To: nmaven-dev@incubator.apache.org
Subject: Re: How is SettingsGeneratorMojo passed through?

The SolutionGenerator is a .NET plugin, so the correct solution is to
add the following field:

  [FieldAttribute("repository", Expression =
"${settings.localRepository}", Type = "java.lang.String")]
  public String localRepository;

to the SolutionGeneratorMojo (c#) class. Then regenerate the
javabindings, taking care to preserve the  AbstractMojo.preExecute
implementaion method.
This field will then always have the correct repository in sync with
what Maven is using.

Regards,
Shane


On 6/14/07, Deacon, Brian <Br...@intuit.com> wrote:
>
> I'm trying to suss out a solution to the problem of 
> SettingsGeneratorMojo.cs getting lost if "HOMEPATH" doesn't point it 
> to the same place as java's user.home property.  (Jira issue 79)
>
> It would seem that SettingsGeneratorMojo.java is a bucket for these 
> types of values, and would like something like this:
>
> public String getM2UserHome()
> {
> return System.getProperty("user.home") + File.separator + ".m2"; }
>
> Since it is System.getProperty("user.home") that ultimately dictates 
> where the .m2 directory is.
>
> I -think-
> Environment.GetEnvironmentVariable("USERPROFILE")
> is always available and we should use that over
> Environment.GetEnvironmentVariable("SystemDrive") +
> Environment.GetEnvironmentVariable("HOMEPATH")
>
> But I think bestest would be for the java side to explicitly hand over

> the value through something like the getM2UserHome property I propose 
> above.  But I can't seem to see where SettingsGeneratorMojo.java ever 
> gets called to pass those values along to the .Net side, if it even 
> does.  Can anyone point me in the right direction?
>
> Meanwhile still trying to get eclipse to bend to my will...
>
> B
>

Re: How is SettingsGeneratorMojo passed through?

Posted by Shane Isbell <sh...@gmail.com>.
The SolutionGenerator is a .NET plugin, so the correct solution is to add
the following field:

  [FieldAttribute("repository", Expression = "${settings.localRepository}",
Type = "java.lang.String")]
  public String localRepository;

to the SolutionGeneratorMojo (c#) class. Then regenerate the javabindings,
taking care to preserve the  AbstractMojo.preExecute implementaion method.
This field will then always have the correct repository in sync with what
Maven is using.

Regards,
Shane


On 6/14/07, Deacon, Brian <Br...@intuit.com> wrote:
>
> I'm trying to suss out a solution to the problem of
> SettingsGeneratorMojo.cs getting lost if "HOMEPATH" doesn't point it to
> the same place as java's user.home property.  (Jira issue 79)
>
> It would seem that SettingsGeneratorMojo.java is a bucket for these
> types of values, and would like something like this:
>
> public String getM2UserHome()
> {
> return System.getProperty("user.home") + File.separator + ".m2";
> }
>
> Since it is System.getProperty("user.home") that ultimately dictates
> where the .m2 directory is.
>
> I -think-
> Environment.GetEnvironmentVariable("USERPROFILE")
> is always available and we should use that over
> Environment.GetEnvironmentVariable("SystemDrive") +
> Environment.GetEnvironmentVariable("HOMEPATH")
>
> But I think bestest would be for the java side to explicitly hand over
> the value through something like the getM2UserHome property I propose
> above.  But I can't seem to see where SettingsGeneratorMojo.java ever
> gets called to pass those values along to the .Net side, if it even
> does.  Can anyone point me in the right direction?
>
> Meanwhile still trying to get eclipse to bend to my will...
>
> B
>