Hi

Ok, I'll give that a try and see what happens then. Anyways, the issue of 
archetype:create and baseDir still stands.

Hermod

-----Original Message-----
From: Ovidio Mallo [mailto:[EMAIL PROTECTED]
Sent: Wednesday, May 31, 2006 8:30 AM
To: Maven Developers List
Subject: Re: creating a new project with the MavenEmbedder


Hi Hermod,

I'm not sure what it is but in any case I would avoid calling a second goal
together with the archetype:create goal which should work on the project
yet to be created since the following maven2 invocation also fails on the
commandline:

     mvn -DgroupId=a.b.c -DartifactId=d archetype:create eclipse:eclipse

This is because eclipse:eclipse needs some project but at the time of
invocation none exists yet (you are still creating it). This would then
probably explain that when you set your POM file "E:/foo/pom.xml" on the
request, the eclipse:eclipse goal is attached to that existing project
and not to the one being created. So, I would really execute the two goals
archetype:create and eclipse:eclipse one after the other.

Bye,
   Ovidio

[EMAIL PROTECTED] wrote:
> Hi 
> 
> A little update. I added .setPomFile("E:/foo/pom.xml") to 
> DefaultMavenExecutionRequest, and now it definitly gets weird :
> 
> [ maven embedder INFO] 
> ----------------------------------------------------------------------------
> [ maven embedder INFO] Using following parameters for creating Archetype: 
> maven-archetype-quickstart:RELEASE
> [ maven embedder INFO] 
> ----------------------------------------------------------------------------
> [ maven embedder INFO] Parameter: groupId, Value: a.b.c
> [ maven embedder INFO] Parameter: packageName, Value: a.b.c
> [ maven embedder INFO] Parameter: basedir, Value: E:\IT-01 Maven\TestMavenRun
> [ maven embedder INFO] Parameter: package, Value: a.b.c
> [ maven embedder INFO] Parameter: version, Value: 0.1-SNAPSHOT
> [ maven embedder INFO] Parameter: artifactId, Value: new_project
> [ maven embedder INFO] ********************* End of debug info from resources 
> from generated POM ***********************
> [ maven embedder INFO] Archetype created in dir: E:\IT-01 
> Maven\TestMavenRun\new_project
> [ maven embedder INFO] 
> ----------------------------------------------------------------------------
> [ maven embedder INFO] Building Unnamed - 
> a.b.c:stdproject-plugin:jar:0.1-SNAPSHOT
> [ maven embedder INFO]    task-segment: [eclipse:eclipse]
> [ maven embedder INFO] 
> ----------------------------------------------------------------------------
> [ maven embedder INFO] Preparing eclipse:eclipse
> [ maven embedder INFO] No goals needed for project - skipping
> [ maven embedder INFO] Not writing settings - defaults suffice
> [ maven embedder INFO] Wrote Eclipse project for "stdproject-plugin" to 
> E:\foo.
> [ maven embedder INFO] 
> ------------------------------------------------------------------------
> [ maven embedder INFO] BUILD SUCCESSFUL
> [ maven embedder INFO] 
> ------------------------------------------------------------------------
> 
> So now it is still creating the project in the current directory with the 
> archetype:create goal, but it is creating the eclipse stuff in foo !?
> 
> Hermod
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, May 31, 2006 7:18 AM
> To: dev@maven.apache.org
> Subject: RE: creating a new project with the MavenEmbedder
> 
> 
> Hi
> 
> I tried what you suggested, and it did create a project in a directory with 
> the given artifactId, i.e:
> 
> mvn -f foo/pom.xml archetype:create -DartifactId=whatever <<< creates a 
> project under whatever and the output is :
> 
> ....
> [INFO] Parameter: groupId, Value: a.b.c
> [INFO] Parameter: packageName, Value: a.b.c
> [INFO] Parameter: basedir, Value: E:\
> [INFO] Parameter: package, Value: a.b.c
> [INFO] Parameter: version, Value: 1.0-SNAPSHOT
> [INFO] Parameter: artifactId, Value: whatever
> [INFO] ********************* End of debug info from resources from generated 
> POM
>  ***********************
> [INFO] Archetype created in dir: E:\whatever
> ....
> 
> However, running this code (with goals="archetype:create" & "eclipse:eclipse" 
> :
> 
>               MavenExecutionRequest request = new 
> DefaultMavenExecutionRequest()
>                               .setBasedir(new File("E:/Test")).setGoals(goals)
>                               .setLocalRepositoryPath(
>                                               
> embedder.getLocalRepositoryPath(settings)).setSettings(
>                                               
> settings).setProperties(properties).addEventMonitor(
>                                               new DefaultEventMonitor(new 
> ConsoleLogger(
>                                                               
> ConsoleLogger.LEVEL_DISABLED, "logger")));
> 
>               embedder.execute(request);
> 
> 
> Gives:
> 
> ....
> [ maven embedder INFO] artifact 
> org.apache.maven.archetypes:maven-archetype-quickstart: checking for updates 
> from central
> [ maven embedder INFO] 
> ----------------------------------------------------------------------------
> [ maven embedder INFO] Using following parameters for creating Archetype: 
> maven-archetype-quickstart:RELEASE
> [ maven embedder INFO] 
> ----------------------------------------------------------------------------
> [ maven embedder INFO] Parameter: groupId, Value: a.b.c
> [ maven embedder INFO] Parameter: packageName, Value: a.b.c
> [ maven embedder INFO] Parameter: basedir, Value: E:\IT-01 Maven\TestMavenRun
> [ maven embedder INFO] Parameter: package, Value: a.b.c
> [ maven embedder INFO] Parameter: version, Value: 0.1-SNAPSHOT
> [ maven embedder INFO] Parameter: artifactId, Value: new_project
> [ maven embedder INFO] ********************* End of debug info from resources 
> from generated POM ***********************
> [ maven embedder INFO] Archetype created in dir: E:\IT-01 
> Maven\TestMavenRun\new_project
> [ maven embedder INFO] 
> ----------------------------------------------------------------------------
> [ maven embedder INFO] Building Maven Default Project
> [ maven embedder INFO]    task-segment: [eclipse:eclipse]
> [ maven embedder INFO] 
> ----------------------------------------------------------------------------
> [ maven embedder INFO] Preparing eclipse:eclipse
> [ maven embedder INFO] No goals needed for project - skipping
> [ maven embedder INFO] 
> ------------------------------------------------------------------------
> [ maven embedder ERROR] BUILD ERROR
> [ maven embedder INFO] 
> ------------------------------------------------------------------------
> [ maven embedder INFO] Cannot execute mojo: eclipse. It requires a project 
> with an existing pom.xml, but the build is not using one.
> [ maven embedder INFO] 
> ------------------------------------------------------------------------
> .....
> 
> Notice that the basedir from the log output does not match what was given as 
> input parameter to .setBasedir. It looks like it is ignoring it alltogether.
> 
> Hermod
> 
> -----------------------------------------------------
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, May 30, 2006 2:03 PM
> To: dev@maven.apache.org
> Subject: RE: creating a new project with the MavenEmbedder
> 
> 
> Hi
> 
> I'll give it a try. If it does not work, I'll look into what goes on in 
> DefaultMavenExecutionRequest.
> 
> 
> Hermod
> 
> -----Original Message-----
> From: Trygve Laugstøl [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, May 30, 2006 1:55 PM
> To: Maven Developers List
> Subject: Re: creating a new project with the MavenEmbedder
> 
> 
> [EMAIL PROTECTED] wrote:
> 
>>Hi
>>
>>Now that I got it running, I have discovered something that may be an error 
>>in the DefaultExecutionRequest:
>>
>>This is how I run it:
>>
>>              MavenExecutionRequest request = new 
>> DefaultMavenExecutionRequest()
>>                              .setBasedir(new File("E:/Test")).setGoals(goals)
>>                              .setLocalRepositoryPath(
>>                                              
>> embedder.getLocalRepositoryPath(settings)).setSettings(
>>                                              
>> settings).setProperties(properties).addEventMonitor(
>>                                              new DefaultEventMonitor(new 
>> ConsoleLogger(
>>                                                              
>> ConsoleLogger.LEVEL_DISABLED, "logger")));
>>
>>
>>The problem is that is is ignoring the ".setBasedir(new File("E:/Test"))" and 
>>creating the project in the current directory ( I am running the 
>>"archetype:create" goal). Is this a known error or am I presuming wrong here.
> 
> 
> This might be a issue with the archetype mojo.
> 
> Try this:
> 
> * Create a pom.xml under foo/
> * mvn -f foo/pom.xml archetype:create ..
> 
> If the files are created in the current directory that's an issue with 
> the Mojo. I've used the embedder successfully myself so I'm pretty sure 
> that it works as expected, though I haven't used it without a pom.xml 
> under the basedir.
> 
> --
> 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 the DnB NOR Group
> 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]
> 
> 
> ---------------------------------------------------------------------
> 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]


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

Reply via email to