You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by João Kreuzberg <iv...@gmail.com> on 2007/08/08 04:49:49 UTC

[CREATE:ARCHETYPE - MAVEN EMBEDDER]

Maria,

I tried the user.dir within the command line and it works just fine.

When I try to execute it using maven-embedder

it just ignores the base directory.

Here is how I'm using it:

        MavenExecutionRequest executionRequest = new
DefaultMavenExecutionRequest();

        executionRequest.setGoals(Arrays
                .asList(new String[] { "archetype:create" }));

        Properties params = new Properties();

        params.put("groupId", groupId);
        params.put("artifactId", artifactId);
        params.put("version", version == null ? "1.0" : version);
        params.put("archetypeGroupId", archetypeGroupId);
        params.put("archetypeArtifactId", archetypeArtifactId);
        params.put("archetypeVersion", archetypeVersion);
        params.put("remoteRepositories", remoteRepo);
        params.put("user.dir", validProjectLocation);

        executionRequest.setProperties(params);

        executionRequest.setBaseDirectory(new File(validProjectLocation));

        MavenExecutionResult result = this.getEmbedder
().execute(executionRequest);


in this case, validProjectLocation  is E:\myproject

but this is what I get on the console

[INFO] Parameter: groupId, Value: com.myproject
[INFO] Parameter: packageName, Value: com.myproject
[INFO] Parameter: basedir, Value: C:\dev\eclipse
[INFO] Parameter: package, Value: com.myproject
[INFO] Parameter: version, Value: 1.0
[INFO] Parameter: artifactId, Value: myproject
[INFO] ********************* End of debug info from resources from generated
POM ***********************

It's ignoring the user.dir parameter

I also tried basedir instead, but does not work

Am I missing something?

Best Regards,

João Kreuzberg

On 8/7/07, João Kreuzberg <iv...@gmail.com> wrote:
>
> YES,
>
> that works :)
>
> Thanks so much,
>
> Best regards,
>
> João Kreuzberg
>
> On 8/7/07, Maria Odea Ching < oching@exist.com> wrote:
> >
> > Hi,
> >
> > You've got the wrong parameter name.. it should be user.dir instead of
> > basedir.
> >
> > HTH,
> > Deng
> >
> > João Kreuzberg wrote:
> > > Hello guys,
> > >
> > > I'm having a problem with create:archetype
> > >
> > > on the site is says it has a -Dbasedir parameter
> > > but it doesn't seems to work
> > > I tried mvn archetype:create -DgroupId=joao -DartifactId=joao
> > -Dbasedir=C:\
> > > but it does not create the project on the specified dir
> > > it creates on the current dir
> > > any thoughts?
> > >
> > > Best regards,
> > >
> > >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
>
> --
> João Kreuzberg




-- 
João Kreuzberg

Re: [CREATE:ARCHETYPE - MAVEN EMBEDDER]

Posted by Brett Porter <br...@gmail.com>.
I think that the embedder might re-set user.dir to the location of the
POM (though you seem to be setting that yourself to the same location,
so I'm not sure why that would be a problem...)

Not sure that helps, just a thought.

- Brett

On 09/08/07, Maria Odea Ching <oc...@exist.com> wrote:
> Hi Joao,
>
> I'm not sure what the problem is.. the configuration below seems to be
> correct.
>
> -Deng
>
> João Kreuzberg wrote:
> > Maria,
> >
> > I tried the user.dir within the command line and it works just fine.
> >
> > When I try to execute it using maven-embedder
> >
> > it just ignores the base directory.
> >
> > Here is how I'm using it:
> >
> >         MavenExecutionRequest executionRequest = new
> > DefaultMavenExecutionRequest();
> >
> >         executionRequest.setGoals(Arrays
> >                 .asList(new String[] { "archetype:create" }));
> >
> >         Properties params = new Properties();
> >
> >         params.put("groupId", groupId);
> >         params.put("artifactId", artifactId);
> >         params.put("version", version == null ? "1.0" : version);
> >         params.put("archetypeGroupId", archetypeGroupId);
> >         params.put("archetypeArtifactId", archetypeArtifactId);
> >         params.put("archetypeVersion", archetypeVersion);
> >         params.put("remoteRepositories", remoteRepo);
> >         params.put("user.dir", validProjectLocation);
> >
> >         executionRequest.setProperties(params);
> >
> >         executionRequest.setBaseDirectory(new File(validProjectLocation));
> >
> >         MavenExecutionResult result = this.getEmbedder
> > ().execute(executionRequest);
> >
> >
> > in this case, validProjectLocation  is E:\myproject
> >
> > but this is what I get on the console
> >
> > [INFO] Parameter: groupId, Value: com.myproject
> > [INFO] Parameter: packageName, Value: com.myproject
> > [INFO] Parameter: basedir, Value: C:\dev\eclipse
> > [INFO] Parameter: package, Value: com.myproject
> > [INFO] Parameter: version, Value: 1.0
> > [INFO] Parameter: artifactId, Value: myproject
> > [INFO] ********************* End of debug info from resources from generated
> > POM ***********************
> >
> > It's ignoring the user.dir parameter
> >
> > I also tried basedir instead, but does not work
> >
> > Am I missing something?
> >
> > Best Regards,
> >
> > João Kreuzberg
> >
> > On 8/7/07, João Kreuzberg <iv...@gmail.com> wrote:
> >
> >> YES,
> >>
> >> that works :)
> >>
> >> Thanks so much,
> >>
> >> Best regards,
> >>
> >> João Kreuzberg
> >>
> >> On 8/7/07, Maria Odea Ching < oching@exist.com> wrote:
> >>
> >>> Hi,
> >>>
> >>> You've got the wrong parameter name.. it should be user.dir instead of
> >>> basedir.
> >>>
> >>> HTH,
> >>> Deng
> >>>
> >>> João Kreuzberg wrote:
> >>>
> >>>> Hello guys,
> >>>>
> >>>> I'm having a problem with create:archetype
> >>>>
> >>>> on the site is says it has a -Dbasedir parameter
> >>>> but it doesn't seems to work
> >>>> I tried mvn archetype:create -DgroupId=joao -DartifactId=joao
> >>>>
> >>> -Dbasedir=C:\
> >>>
> >>>> but it does not create the project on the specified dir
> >>>> it creates on the current dir
> >>>> any thoughts?
> >>>>
> >>>> Best regards,
> >>>>
> >>>>
> >>>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> >>> For additional commands, e-mail: users-help@maven.apache.org
> >>>
> >>>
> >>>
> >> --
> >> João Kreuzberg
> >>
> >
> >
> >
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>


-- 
Brett Porter
Blog: http://www.devzuz.org/blogs/bporter/

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


Re: [CREATE:ARCHETYPE - MAVEN EMBEDDER]

Posted by Maria Odea Ching <oc...@exist.com>.
Hi Joao,

I'm not sure what the problem is.. the configuration below seems to be 
correct.

-Deng

João Kreuzberg wrote:
> Maria,
>
> I tried the user.dir within the command line and it works just fine.
>
> When I try to execute it using maven-embedder
>
> it just ignores the base directory.
>
> Here is how I'm using it:
>
>         MavenExecutionRequest executionRequest = new
> DefaultMavenExecutionRequest();
>
>         executionRequest.setGoals(Arrays
>                 .asList(new String[] { "archetype:create" }));
>
>         Properties params = new Properties();
>
>         params.put("groupId", groupId);
>         params.put("artifactId", artifactId);
>         params.put("version", version == null ? "1.0" : version);
>         params.put("archetypeGroupId", archetypeGroupId);
>         params.put("archetypeArtifactId", archetypeArtifactId);
>         params.put("archetypeVersion", archetypeVersion);
>         params.put("remoteRepositories", remoteRepo);
>         params.put("user.dir", validProjectLocation);
>
>         executionRequest.setProperties(params);
>
>         executionRequest.setBaseDirectory(new File(validProjectLocation));
>
>         MavenExecutionResult result = this.getEmbedder
> ().execute(executionRequest);
>
>
> in this case, validProjectLocation  is E:\myproject
>
> but this is what I get on the console
>
> [INFO] Parameter: groupId, Value: com.myproject
> [INFO] Parameter: packageName, Value: com.myproject
> [INFO] Parameter: basedir, Value: C:\dev\eclipse
> [INFO] Parameter: package, Value: com.myproject
> [INFO] Parameter: version, Value: 1.0
> [INFO] Parameter: artifactId, Value: myproject
> [INFO] ********************* End of debug info from resources from generated
> POM ***********************
>
> It's ignoring the user.dir parameter
>
> I also tried basedir instead, but does not work
>
> Am I missing something?
>
> Best Regards,
>
> João Kreuzberg
>
> On 8/7/07, João Kreuzberg <iv...@gmail.com> wrote:
>   
>> YES,
>>
>> that works :)
>>
>> Thanks so much,
>>
>> Best regards,
>>
>> João Kreuzberg
>>
>> On 8/7/07, Maria Odea Ching < oching@exist.com> wrote:
>>     
>>> Hi,
>>>
>>> You've got the wrong parameter name.. it should be user.dir instead of
>>> basedir.
>>>
>>> HTH,
>>> Deng
>>>
>>> João Kreuzberg wrote:
>>>       
>>>> Hello guys,
>>>>
>>>> I'm having a problem with create:archetype
>>>>
>>>> on the site is says it has a -Dbasedir parameter
>>>> but it doesn't seems to work
>>>> I tried mvn archetype:create -DgroupId=joao -DartifactId=joao
>>>>         
>>> -Dbasedir=C:\
>>>       
>>>> but it does not create the project on the specified dir
>>>> it creates on the current dir
>>>> any thoughts?
>>>>
>>>> Best regards,
>>>>
>>>>
>>>>         
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>>       
>> --
>> João Kreuzberg
>>     
>
>
>
>
>   


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