Hi

I might have a slight variation to you statement about goals operating on pom's 
or not. Let's say that you are creating an archetype that creates a specific 
multiproject layout where the pom beeing operated on is about to become a 
module in maybe "weird" module structure. In such a case there might actualy be 
a difference between the path to the pom, and what you consider the basedir of 
you structure.

I'll give your patch a try and see if it solves the problem immidiatly at hand.

Hermod

-----Original Message-----
From: Ovidio Mallo [mailto:[EMAIL PROTECTED]
Sent: Sunday, June 04, 2006 4:52 PM
To: Maven Developers List
Subject: Re: creating a new project with the MavenEmbedder


Hi,

I'm attaching a patch which tries to solve the issue with the basedir
discussed in this thread. The value of the ${basedir} expression is
thereby computed by one of the following fallbacks (in the given order):

1. If the goal being executed is attached to a project, take the directory where
    the POM file of the project resides as the ${basedir}.
2. If a basedir has been specified on the MavenExecutionRequest, take this as
    the ${basedir}.
3. Otherwise, take System.getProperty( "user.dir" ) as the ${basedir}.

The patch merely introduces the fallback 2. In the current implementation,
1. and 3. are already used.

Before taking any further step, I wanted to ask whether the above behavior would
be OK. So, if anyone is willing to have a brief look at the patch (it's very
short), that would be great as I'm still very new to the code.
Thanks a lot in advance!

BTW: Combining this patch with Hermod's one for the archetype plugin should
      solve the problem of the plugin not respecting the specified basedir when
      creating a new project.

Greets,
   Ovidio



[EMAIL PROTECTED] wrote:
> Hi
> 
> Something must be wrong in another place. The eclipse:eclipse goal excutes ok 
> with the supplied (i.e correct) basedir, but the MavenArchetypeMojo for some 
> reason is supplied the working directory, which is not what is supplied in 
> the call.
> 
> Here is the patch :
> 
> Index: MavenArchetypeMojo.java
> ===================================================================
> --- MavenArchetypeMojo.java   (revisjon 410213)
> +++ MavenArchetypeMojo.java   (arbeidskopi)
> @@ -33,6 +33,7 @@
>  import java.util.HashMap;
>  import java.util.List;
>  import java.util.Map;
> +import java.io.File;
>  
>  /**
>   * The archetype creation goal looks for an archetype with a given groupId, 
> artifactId, and
> @@ -122,6 +123,12 @@
>       */
>      private MavenProject project;
>  
> +    /**
> +     * @parameter expression="${basedir}"
> +     */
> +    private File basedir;
> +
> +
>      public void execute()
>          throws MojoExecutionException
>      {
> @@ -143,8 +150,6 @@
>              groupId = project.getGroupId();
>          }
>  
> -        String basedir = System.getProperty( "user.dir" );
> -
>          if ( packageName == null )
>          {
>              getLog().info( "Defaulting package to group ID: " + groupId );
> @@ -155,7 +160,7 @@
>          // TODO: context mojo more appropriate?
>          Map map = new HashMap();
>  
> -        map.put( "basedir", basedir );
> +        map.put( "basedir", basedir.getAbsolutePath() );
>  
>          map.put( "package", packageName );
>   
> 
> -----Original Message-----
> From: Trygve Laugstøl [mailto:[EMAIL PROTECTED]
> Sent: Friday, June 02, 2006 9:26 AM
> To: Maven Developers List
> Subject: Re: creating a new project with the MavenEmbedder
> 
> 
> [EMAIL PROTECTED] wrote:
> 
>>Hi
>>
>>Have not had the time before now.
>>
>>It still does not work. The basedir is still set to the current directory.
> 
> 
> The ${basedir} will be set to the value you set in the embedder, this is 
> working for me in my IDEA plugin where I use the embedder.
> 
> Can you include the patch from the assembly plugin so I can see what you 
> did?
> 
> --
> Trygve
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> 
> This email with attachments is solely for the use of the individual or
> entity to whom it is addressed. Please also be aware that DnB NOR cannot
> accept any payment orders or other legally binding correspondence with
> customers as a part of an email. 
> 
> This email message has been virus checked by the anti virus programs used
> in the DnB NOR Group.
> 
> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 




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

Reply via email to