Re: svn commit: r410135 - in /maven/site/trunk: pom.xml src/site/apt/articles.apt

2006-05-29 Thread Dennis Lundberg

[EMAIL PROTECTED] wrote:

Author: carlos
Date: Mon May 29 11:18:26 2006
New Revision: 410135

URL: http://svn.apache.org/viewvc?rev=410135&view=rev
Log:
Added articles, book and fixed typos

Modified:
maven/site/trunk/pom.xml
maven/site/trunk/src/site/apt/articles.apt

Modified: maven/site/trunk/pom.xml
URL: 
http://svn.apache.org/viewvc/maven/site/trunk/pom.xml?rev=410135&r1=410134&r2=410135&view=diff
==
--- maven/site/trunk/pom.xml (original)
+++ maven/site/trunk/pom.xml Mon May 29 11:18:26 2006
@@ -3,7 +3,7 @@
   
 maven-parent
 org.apache.maven
-1
+2-SNAPSHOT
 ../pom/maven/pom.xml
   
   4.0.0

Modified: maven/site/trunk/src/site/apt/articles.apt
URL: 
http://svn.apache.org/viewvc/maven/site/trunk/src/site/apt/articles.apt?rev=410135&r1=410134&r2=410135&view=diff
==
--- maven/site/trunk/src/site/apt/articles.apt (original)
+++ maven/site/trunk/src/site/apt/articles.apt Mon May 29 11:18:26 2006
@@ -8,8 +8,20 @@
 
 Books on Maven
 
+ * Better Builds with Maven

+
+  * Maven 2
+
+  * {{{http://library.mergere.com}Mergere Library Press}}. Free PDF download.
+
+  * {{{http://www.commonjava.org/blogs/john}John Casey}}, 
{{{http://blogs.codehaus.org/people/vmassol/}Vincent Massol}}, 
{{{http://blogs.codehaus.org/people/vmassol/}Brett Porter}}, 
{{{http://www.jroller.com/page/carlossg}Carlos Sanchez}}, 
{{{http://blogs.codehaus.org/projects/maven/}Jason Van Zyl}}


The link to Brett's blog goes to Vincent's blog...


+
+  * March 2006
+
  * Maven: A Developer's Notebook
 
+  * Maven 1

+
   * O'Reilly
 
   * Vincent Massol, Tim O'Brien

@@ -20,15 +32,15 @@
 
  Have written or would like to write a story on Maven? {{{../../mail-lists.html}Contact us}} on the developers mailing list.
 
- * {{{http://www.internetnews.com/dev-news/article.php/3381841}Apache's Maven Comes of Age}} (Coverage of the release of Maven 1.0)

+Articles on Maven
 
-  * internetnews.com

+ * {{{http://www.javaworld.com/javaworld/jw-05-2006/jw-0529-maven.html}The 
Maven 2 POM demystified}}
 
-  * Sean Michael Kerner

+  * JavaWorld
 
-  * 15 July 2004

+  * Eric Redmond
 
-Articles on Maven

+  * 29 May 2006
 
  * {{{http://blogs.codehaus.org/people/vmassol/archives/001275_javapolis_2005_slides_on_maven_2.html}Maven 2.0 - Javapolis 2005}}
 
@@ -96,6 +108,14 @@
 
   * August 2004
 
+ * {{{http://www.internetnews.com/dev-news/article.php/3381841}Apache's Maven Comes of Age}} (Coverage of the release of Maven 1.0)

+
+  * internetnews.com
+
+  * Sean Michael Kerner
+
+  * 15 July 2004
+
  * {{{http://www.onjava.com/pub/a/onjava/2004/03/17/maven.html}Extending Maven 
Through Plugins by Eric Pugh}}
 
   * OnJava

@@ -154,7 +174,7 @@
 
  * {{{http://www.javausergroup.at/events/maven.pdf}The Stairway to Maven}}
 
-  * Siegfried G�SCHL

+  * Siegfried GOSCHL
 
   * 26 June 2002
 
@@ -170,7 +190,7 @@
 
   * Astrogrid
 
- * {{{http://etudiant.univ-mlv.fr/~mvongvil/Maven_Intro.html}An Introduction to Maven (in French).}}

+ * {{{http://etudiant.univ-mlv.fr/~mvongvil/Maven_Intro.html}An Introduction 
to Maven (in French).}}
 
  * {{{http://hotwork.sourceforge.net/hotwork/manual/maven/index.html}A tutorial for Maven, J2EE projects, and MevenIDE}} (in Portuguese).
 






--
Dennis Lundberg


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



Re: creating a new project with the MavenEmbedder

2006-05-29 Thread Rinku

Hi Hermod,

Coincidently, there was a thread on maven-users list about delegating 
goal to another mojo (see yesterday's posts). I have posted a similar 
code snippet there that uses embedder, you might want give it a try if 
you want to stick to released version.


HTH,
Rahul

- Original Message - 
From: <[EMAIL PROTECTED]>

To: 
Sent: Tuesday, May 30, 2006 12:34 AM
Subject: RE: creating a new project with the MavenEmbedder


Hi

Ok, I'll get it from SVN and compile it. Thnx

Hermod

-Original Message-
From: Ovidio Mallo [mailto:[EMAIL PROTECTED]
Sent: Monday, May 29, 2006 1:58 PM
To: Maven Developers List
Subject: Re: creating a new project with the MavenEmbedder


Hi Hermod!

The class compiles against the current 2.1-SNAPSHOT version. The 
previous
versions 2.0.3 and 2.0.4 seem to have a somewhat different API, so it 
will

not compile with those. Prior to my original post on this subject, I was
trying to get the whole thing working with the version 2.0.4, but 
failed,

so I'm not sure whether it is possible to achieve the same thing with
the old API.
Unfortunately, since the version 2.1-SNAPSHOT is probably not on the 
central

repository, you probably have to compile it from the sources. That's at
least what I did.

Hope that helps!

Best regards,
  Ovidio

[EMAIL PROTECTED] wrote:

Hi

Which version of the embedder is this? I get errors on the methods: 
getUserSettingsPath and getGlobalSettingsPath - No such methods in the 
Maven embedder (2.0.3).


Hermod

-Original Message-
From: Ovidio Mallo [mailto:[EMAIL PROTECTED]
Sent: Sunday, May 28, 2006 12:36 PM
To: Maven Developers List
Subject: Re: creating a new project with the MavenEmbedder


Hi,

Thanks a lot, Kenney, for your explanation and code snippet! This is
exactly what I was looking for! I have filled in the tiny missing
details in your sample code to build up a working example which you
can find below. Just in case anyone else is interested in it.

One thing I noticed is that the example should not be run from
within a directory containing a pom.xml file since, otherwise,
this project file is interpreted as being the parent model file!

Well, again, thanks a lot!

Regards,
   Ovidio




public class ProjectCreator {

   public static void main(String[] args) throws Exception {
 MavenEmbedder embedder = new MavenEmbedder();

 embedder.setClassLoader( 
Thread.currentThread().getContextClassLoader() );


 embedder.setLogger( new MavenEmbedderConsoleLogger() );

 embedder.start();

 Settings settings = embedder.buildSettings(
 embedder.getUserSettingsPath( null ),
 embedder.getGlobalSettingsPath(),
 false,
 false,
 false,
 Boolean.FALSE );

 Properties properties = new Properties();
 properties.put( "groupId", "net.sytes.meco" );
 properties.put( "artifactId", "new_project" );

 MavenExecutionRequest request = new 
DefaultMavenExecutionRequest()

   .setBasedir( new File( "/tmp" ) )
   .setGoals( Arrays.asList( new String[] { 
"archetype:create" } ) )
   .setLocalRepositoryPath( embedder.getLocalRepositoryPath( 
settings ) )

   .setSettings( settings )
   .setProperties( properties )
   .addEventMonitor(
   new DefaultEventMonitor(
   new ConsoleLogger( ConsoleLogger.LEVEL_DISABLED, 
"logger" ) ) );


 embedder.execute( request );
   }
}




Kenney Westerhof wrote:
 > On Sat, 27 May 2006, Ovidio Mallo wrote:
 >
 > Hi,
 >
 > Well, currently running archetype:create seems the simplest way to 
me.
 > The embedder is primarily meant to build projects, not to create 
them.

 >
 > You might want to take a look at the maven-cli project. Some 
plugins, like

 > archetype, don't require an existing pom.xml.
 >
 > A sequence like this (more or less) should work for you:
 >
 > MavenEmbedder embedder = new MavenEmbedder();
 >
 > embedder.start();
 >
 > Settings settings = embedder.buildSettings(
 > embedder.getUserSettingsPath( null ),
 > embedder.getGlobalSettingsPath(),
 > false,
 > false,
 > false,
 > false );
 >
 > Properties properties = new Properties();
 > // set archetype parameters in properties
 >
 > MavenExecutionRequest request = new DefaultMavenExecutionRequest()
 > .setBasedir(..)
 > .setGoals( Arrays.asList( new String[] { "archetype.create" } )
 > .setLocalRepositoryPath( embedder.getLocalRepositoryPath( 
settings )

 > .setSettings( settings )
 > .setProperties( properties );
 >
 > embedder.execute( request );
 >
 > .. and we don't set a pom file here.
 >
 > Good luck!
 >
 > -- Kenney
 >
 >
 >
 >>Hi everyone!
 >>
 >>I just wanted to ask whether there is a clean way to create a new 
maven

 >>project using the MavenEmbedder API. It is of course possible to
 >>execute the "archetype:create" goal but the API seems to always
 >>requ

RE: creating repository upload bundles

2006-05-29 Thread Mike Perham
Nevermind.  Carlos pointed out the part of the mini guide that answers
my question.

-Original Message-
From: Mike Perham [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 29, 2006 1:32 PM
To: Maven Developers List
Subject: creating repository upload bundles

I keep getting requests to create for upload bundles for new binaries
which I want to see in the  repository.  Now I'm all for standardizing
this process but how are we supposed to create upload bundles for
projects which aren't based on Maven 2?

-
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]



creating repository upload bundles

2006-05-29 Thread Mike Perham
I keep getting requests to create for upload bundles for new binaries
which I want to see in the  repository.  Now I'm all for standardizing
this process but how are we supposed to create upload bundles for
projects which aren't based on Maven 2?

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



The Maven 2 POM Demystified

2006-05-29 Thread Eric Redmond

I hope you find this useful. Its not an "introduction" article.

http://www.javaworld.com/javaworld/jw-05-2006/jw-0529-maven.html

Sorry to cross-post, but I'd like to add a link to
http://maven.apache.org/articles.html

Eric


RE: Snapshot feature broken in maven 2?

2006-05-29 Thread Jörg Schaible
[EMAIL PROTECTED] wrote on Monday, May 29, 2006 5:59 PM:

> Hi!
> 
> We use maven 2 to build a large project consisting of several
> modules. Dependencies between modules are handled by the
> maven dependency mechanism. During development, we want to
> use the SNAPSHOT feature because we don't want to have an inflation
> of version numbers. 
> 
> The problem: For me it looks like snapshots are never updated in the
> local repository. 

There was already a thread some days ago (17.5.), where a user had the same 
problems. It seems there is a problem and you should raise an issue in JIRA.

- Jörg

> 
> To track this down, I have done the following test:
> 
> 1. Deploy "interface" to our central repository
> 2. Compile "client" (which depends on "interface")
>pom, jar and metadata are downloaded into local repository.
> 3. Increased version number and timestamp in the file
>1.0-SNAPSHOT/maven-metadata.xml, recomputed checksums.
> 4. Run "mvn -U clean compile" on module "client".
> This results in the following log:
> 
> [INFO] Scanning for projects...
> [INFO]
> --
> --
> [INFO] Building Client for the great calculator
> [INFO]task-segment: [clean, compile]
> [INFO]
> --
> --
> [INFO] artifact org.apache.maven.plugins:maven-clean-plugin:
> checking for updates from central
> [INFO] artifact org.apache.maven.plugins:maven-source-plugin:
> checking for updates from central
> [INFO] artifact
> org.apache.maven.plugins:maven-surefire-plugin: checking for updates
> from central [INFO] [clean:clean]
> [INFO] Deleting directory c:\example\client\target
> [INFO] Deleting directory c:\example\client\target\classes
> [INFO] Deleting directory c:\example\client\target\test-classes
> [INFO] artifact org.apache.maven.plugins:maven-resources-plugin:
> checking for updates from central [INFO] artifact
> org.apache.maven.plugins:maven-compiler-plugin: checking for updates
> from central [INFO] [source-download:download-sources {execution:
> default}] 
> 
> -> [INFO] snapshot
> de.sdm.calculator:interface:1.0-SNAPSHOT: checking for
> updates from central <--
> 
> [INFO] [resources:resources]
> [INFO] Using default encoding to copy filtered resources. [INFO]
> snapshot de.sdm.calculator:calculator-all:1.0-SNAPSHOT: checking for
> updates from central [INFO] [compiler:compile]
> Compiling 1 source file to c:\example\client\target\classes [INFO]
> --
> --
> [INFO] BUILD SUCCESSFUL
> 
> As you can see in the marked line, the check for updates is
> done. Looking into ~/.m2/repository I can see even the new
> maven-metadata-central.xml (new timestamp, new content), but
> the jar is NOT updated from the server.
> 
> Is this intendented behaviour?
> 
> I can solve the problem by setting
> true master pom of the
> project, but this clobberes the local repositories of all
> users and the central repository with lots of old versions.
> 
> Your comments?
> 
> Regards
> 
> Roger
> 
> -
> 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]



Snapshot feature broken in maven 2?

2006-05-29 Thread roger.butenuth
Hi!

We use maven 2 to build a large project consisting of several modules. 
Dependencies between modules are handled by the maven dependency mechanism. 
During development, we want to use the SNAPSHOT feature because we don't want 
to have an inflation of version numbers. 

The problem: For me it looks like snapshots are never updated in the local 
repository.

To track this down, I have done the following test: 

1. Deploy "interface" to our central repository
2. Compile "client" (which depends on "interface")
   pom, jar and metadata are downloaded into local repository.
3. Increased version number and timestamp in the file
   1.0-SNAPSHOT/maven-metadata.xml, recomputed checksums.
4. Run "mvn -U clean compile" on module "client".
This results in the following log:

[INFO] Scanning for projects...
[INFO] 

[INFO] Building Client for the great calculator
[INFO]task-segment: [clean, compile]
[INFO] 

[INFO] artifact org.apache.maven.plugins:maven-clean-plugin: checking for 
updates from central
[INFO] artifact org.apache.maven.plugins:maven-source-plugin: checking for 
updates from central
[INFO] artifact org.apache.maven.plugins:maven-surefire-plugin: checking for 
updates from central
[INFO] [clean:clean]
[INFO] Deleting directory c:\example\client\target
[INFO] Deleting directory c:\example\client\target\classes
[INFO] Deleting directory c:\example\client\target\test-classes
[INFO] artifact org.apache.maven.plugins:maven-resources-plugin: checking for 
updates from central
[INFO] artifact org.apache.maven.plugins:maven-compiler-plugin: checking for 
updates from central
[INFO] [source-download:download-sources {execution: default}]

-> [INFO] snapshot de.sdm.calculator:interface:1.0-SNAPSHOT: checking for 
updates from central <--

[INFO] [resources:resources]
[INFO] Using default encoding to copy filtered resources.
[INFO] snapshot de.sdm.calculator:calculator-all:1.0-SNAPSHOT: checking for 
updates from central
[INFO] [compiler:compile]
Compiling 1 source file to c:\example\client\target\classes
[INFO] 
[INFO] BUILD SUCCESSFUL

As you can see in the marked line, the check for updates is done. Looking into 
~/.m2/repository I can see even the new maven-metadata-central.xml (new 
timestamp, new content), but the jar is NOT updated from the server. 

Is this intendented behaviour? 

I can solve the problem by setting true master 
pom of the project, but this clobberes the local repositories of all users and 
the central repository with lots of old versions. 

Your comments?

Regards

Roger

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



RE: creating a new project with the MavenEmbedder

2006-05-29 Thread hermod.opstvedt
Hi

Ok, I'll get it from SVN and compile it. Thnx

Hermod

-Original Message-
From: Ovidio Mallo [mailto:[EMAIL PROTECTED]
Sent: Monday, May 29, 2006 1:58 PM
To: Maven Developers List
Subject: Re: creating a new project with the MavenEmbedder


Hi Hermod!

The class compiles against the current 2.1-SNAPSHOT version. The previous
versions 2.0.3 and 2.0.4 seem to have a somewhat different API, so it will
not compile with those. Prior to my original post on this subject, I was
trying to get the whole thing working with the version 2.0.4, but failed,
so I'm not sure whether it is possible to achieve the same thing with
the old API.
Unfortunately, since the version 2.1-SNAPSHOT is probably not on the central
repository, you probably have to compile it from the sources. That's at
least what I did.

Hope that helps!

Best regards,
   Ovidio

[EMAIL PROTECTED] wrote:
> Hi
> 
> Which version of the embedder is this? I get errors on the methods: 
> getUserSettingsPath and getGlobalSettingsPath - No such methods in the Maven 
> embedder (2.0.3).
> 
> Hermod
> 
> -Original Message-
> From: Ovidio Mallo [mailto:[EMAIL PROTECTED]
> Sent: Sunday, May 28, 2006 12:36 PM
> To: Maven Developers List
> Subject: Re: creating a new project with the MavenEmbedder
> 
> 
> Hi,
> 
> Thanks a lot, Kenney, for your explanation and code snippet! This is
> exactly what I was looking for! I have filled in the tiny missing
> details in your sample code to build up a working example which you
> can find below. Just in case anyone else is interested in it.
> 
> One thing I noticed is that the example should not be run from
> within a directory containing a pom.xml file since, otherwise,
> this project file is interpreted as being the parent model file!
> 
> Well, again, thanks a lot!
> 
> Regards,
>Ovidio
> 
> 
> 
> 
> public class ProjectCreator {
> 
>public static void main(String[] args) throws Exception {
>  MavenEmbedder embedder = new MavenEmbedder();
> 
>  embedder.setClassLoader( Thread.currentThread().getContextClassLoader() 
> );
> 
>  embedder.setLogger( new MavenEmbedderConsoleLogger() );
> 
>  embedder.start();
> 
>  Settings settings = embedder.buildSettings(
>  embedder.getUserSettingsPath( null ),
>  embedder.getGlobalSettingsPath(),
>  false,
>  false,
>  false,
>  Boolean.FALSE );
> 
>  Properties properties = new Properties();
>  properties.put( "groupId", "net.sytes.meco" );
>  properties.put( "artifactId", "new_project" );
> 
>  MavenExecutionRequest request = new DefaultMavenExecutionRequest()
>.setBasedir( new File( "/tmp" ) )
>.setGoals( Arrays.asList( new String[] { "archetype:create" } ) )
>.setLocalRepositoryPath( embedder.getLocalRepositoryPath( settings ) )
>.setSettings( settings )
>.setProperties( properties )
>.addEventMonitor(
>new DefaultEventMonitor(
>new ConsoleLogger( ConsoleLogger.LEVEL_DISABLED, "logger" ) ) 
> );
> 
>  embedder.execute( request );
>}
> }
> 
> 
> 
> 
> Kenney Westerhof wrote:
>  > On Sat, 27 May 2006, Ovidio Mallo wrote:
>  >
>  > Hi,
>  >
>  > Well, currently running archetype:create seems the simplest way to me.
>  > The embedder is primarily meant to build projects, not to create them.
>  >
>  > You might want to take a look at the maven-cli project. Some plugins, like
>  > archetype, don't require an existing pom.xml.
>  >
>  > A sequence like this (more or less) should work for you:
>  >
>  > MavenEmbedder embedder = new MavenEmbedder();
>  >
>  > embedder.start();
>  >
>  > Settings settings = embedder.buildSettings(
>  >embedder.getUserSettingsPath( null ),
>  >embedder.getGlobalSettingsPath(),
>  >false,
>  >false,
>  >false,
>  >false );
>  >
>  > Properties properties = new Properties();
>  > // set archetype parameters in properties
>  >
>  > MavenExecutionRequest request = new DefaultMavenExecutionRequest()
>  >.setBasedir(..)
>  >.setGoals( Arrays.asList( new String[] { "archetype.create" } )
>  >.setLocalRepositoryPath( embedder.getLocalRepositoryPath( settings )
>  >.setSettings( settings )
>  >.setProperties( properties );
>  >
>  > embedder.execute( request );
>  >
>  > .. and we don't set a pom file here.
>  >
>  > Good luck!
>  >
>  > -- Kenney
>  >
>  >
>  >
>  >>Hi everyone!
>  >>
>  >>I just wanted to ask whether there is a clean way to create a new maven
>  >>project using the MavenEmbedder API. It is of course possible to
>  >>execute the "archetype:create" goal but the API seems to always
>  >>require that you already pass in an existing project (at least
>  >>an existing pom.xml file) in order to execute any goal.
>  >>I think such a feature would be quite handy for othe

Re: creating a new project with the MavenEmbedder

2006-05-29 Thread Ovidio Mallo

Hi Hermod!

The class compiles against the current 2.1-SNAPSHOT version. The previous
versions 2.0.3 and 2.0.4 seem to have a somewhat different API, so it will
not compile with those. Prior to my original post on this subject, I was
trying to get the whole thing working with the version 2.0.4, but failed,
so I'm not sure whether it is possible to achieve the same thing with
the old API.
Unfortunately, since the version 2.1-SNAPSHOT is probably not on the central
repository, you probably have to compile it from the sources. That's at
least what I did.

Hope that helps!

Best regards,
  Ovidio

[EMAIL PROTECTED] wrote:

Hi

Which version of the embedder is this? I get errors on the methods: 
getUserSettingsPath and getGlobalSettingsPath - No such methods in the Maven 
embedder (2.0.3).

Hermod

-Original Message-
From: Ovidio Mallo [mailto:[EMAIL PROTECTED]
Sent: Sunday, May 28, 2006 12:36 PM
To: Maven Developers List
Subject: Re: creating a new project with the MavenEmbedder


Hi,

Thanks a lot, Kenney, for your explanation and code snippet! This is
exactly what I was looking for! I have filled in the tiny missing
details in your sample code to build up a working example which you
can find below. Just in case anyone else is interested in it.

One thing I noticed is that the example should not be run from
within a directory containing a pom.xml file since, otherwise,
this project file is interpreted as being the parent model file!

Well, again, thanks a lot!

Regards,
   Ovidio




public class ProjectCreator {

   public static void main(String[] args) throws Exception {
 MavenEmbedder embedder = new MavenEmbedder();

 embedder.setClassLoader( Thread.currentThread().getContextClassLoader() );

 embedder.setLogger( new MavenEmbedderConsoleLogger() );

 embedder.start();

 Settings settings = embedder.buildSettings(
 embedder.getUserSettingsPath( null ),
 embedder.getGlobalSettingsPath(),
 false,
 false,
 false,
 Boolean.FALSE );

 Properties properties = new Properties();
 properties.put( "groupId", "net.sytes.meco" );
 properties.put( "artifactId", "new_project" );

 MavenExecutionRequest request = new DefaultMavenExecutionRequest()
   .setBasedir( new File( "/tmp" ) )
   .setGoals( Arrays.asList( new String[] { "archetype:create" } ) )
   .setLocalRepositoryPath( embedder.getLocalRepositoryPath( settings ) )
   .setSettings( settings )
   .setProperties( properties )
   .addEventMonitor(
   new DefaultEventMonitor(
   new ConsoleLogger( ConsoleLogger.LEVEL_DISABLED, "logger" ) ) );

 embedder.execute( request );
   }
}




Kenney Westerhof wrote:
 > On Sat, 27 May 2006, Ovidio Mallo wrote:
 >
 > Hi,
 >
 > Well, currently running archetype:create seems the simplest way to me.
 > The embedder is primarily meant to build projects, not to create them.
 >
 > You might want to take a look at the maven-cli project. Some plugins, like
 > archetype, don't require an existing pom.xml.
 >
 > A sequence like this (more or less) should work for you:
 >
 > MavenEmbedder embedder = new MavenEmbedder();
 >
 > embedder.start();
 >
 > Settings settings = embedder.buildSettings(
 >   embedder.getUserSettingsPath( null ),
 >   embedder.getGlobalSettingsPath(),
 >   false,
 >   false,
 >   false,
 >   false );
 >
 > Properties properties = new Properties();
 > // set archetype parameters in properties
 >
 > MavenExecutionRequest request = new DefaultMavenExecutionRequest()
 >   .setBasedir(..)
 >   .setGoals( Arrays.asList( new String[] { "archetype.create" } )
 >   .setLocalRepositoryPath( embedder.getLocalRepositoryPath( settings )
 >   .setSettings( settings )
 >   .setProperties( properties );
 >
 > embedder.execute( request );
 >
 > .. and we don't set a pom file here.
 >
 > Good luck!
 >
 > -- Kenney
 >
 >
 >
 >>Hi everyone!
 >>
 >>I just wanted to ask whether there is a clean way to create a new maven
 >>project using the MavenEmbedder API. It is of course possible to
 >>execute the "archetype:create" goal but the API seems to always
 >>require that you already pass in an existing project (at least
 >>an existing pom.xml file) in order to execute any goal.
 >>I think such a feature would be quite handy for other projects
 >>such as the Maven2 Eclipse Plugin.
 >>
 >>Thanks in advance for any help!
 >>
 >>Regards,
 >>   Ovidio
 >>
 >>-
 >>To unsubscribe, e-mail: [EMAIL PROTECTED]
 >>For additional commands, e-mail: [EMAIL PROTECTED]
 >>
 >
 >
 > --
 > Kenney Westerhof
 > http://www.neonics.com
 > GPG public key: http://www.gods.nl/~forge/kenneyw.key
 >
 > -
 > To unsubscribe, e-mail: [EMAIL P

RE: creating a new project with the MavenEmbedder

2006-05-29 Thread hermod.opstvedt
Hi

Which version of the embedder is this? I get errors on the methods: 
getUserSettingsPath and getGlobalSettingsPath - No such methods in the Maven 
embedder (2.0.3).

Hermod

-Original Message-
From: Ovidio Mallo [mailto:[EMAIL PROTECTED]
Sent: Sunday, May 28, 2006 12:36 PM
To: Maven Developers List
Subject: Re: creating a new project with the MavenEmbedder


Hi,

Thanks a lot, Kenney, for your explanation and code snippet! This is
exactly what I was looking for! I have filled in the tiny missing
details in your sample code to build up a working example which you
can find below. Just in case anyone else is interested in it.

One thing I noticed is that the example should not be run from
within a directory containing a pom.xml file since, otherwise,
this project file is interpreted as being the parent model file!

Well, again, thanks a lot!

Regards,
   Ovidio




public class ProjectCreator {

   public static void main(String[] args) throws Exception {
 MavenEmbedder embedder = new MavenEmbedder();

 embedder.setClassLoader( Thread.currentThread().getContextClassLoader() );

 embedder.setLogger( new MavenEmbedderConsoleLogger() );

 embedder.start();

 Settings settings = embedder.buildSettings(
 embedder.getUserSettingsPath( null ),
 embedder.getGlobalSettingsPath(),
 false,
 false,
 false,
 Boolean.FALSE );

 Properties properties = new Properties();
 properties.put( "groupId", "net.sytes.meco" );
 properties.put( "artifactId", "new_project" );

 MavenExecutionRequest request = new DefaultMavenExecutionRequest()
   .setBasedir( new File( "/tmp" ) )
   .setGoals( Arrays.asList( new String[] { "archetype:create" } ) )
   .setLocalRepositoryPath( embedder.getLocalRepositoryPath( settings ) )
   .setSettings( settings )
   .setProperties( properties )
   .addEventMonitor(
   new DefaultEventMonitor(
   new ConsoleLogger( ConsoleLogger.LEVEL_DISABLED, "logger" ) ) );

 embedder.execute( request );
   }
}




Kenney Westerhof wrote:
 > On Sat, 27 May 2006, Ovidio Mallo wrote:
 >
 > Hi,
 >
 > Well, currently running archetype:create seems the simplest way to me.
 > The embedder is primarily meant to build projects, not to create them.
 >
 > You might want to take a look at the maven-cli project. Some plugins, like
 > archetype, don't require an existing pom.xml.
 >
 > A sequence like this (more or less) should work for you:
 >
 > MavenEmbedder embedder = new MavenEmbedder();
 >
 > embedder.start();
 >
 > Settings settings = embedder.buildSettings(
 >  embedder.getUserSettingsPath( null ),
 >  embedder.getGlobalSettingsPath(),
 >  false,
 >  false,
 >  false,
 >  false );
 >
 > Properties properties = new Properties();
 > // set archetype parameters in properties
 >
 > MavenExecutionRequest request = new DefaultMavenExecutionRequest()
 >  .setBasedir(..)
 >  .setGoals( Arrays.asList( new String[] { "archetype.create" } )
 >  .setLocalRepositoryPath( embedder.getLocalRepositoryPath( settings )
 >  .setSettings( settings )
 >  .setProperties( properties );
 >
 > embedder.execute( request );
 >
 > .. and we don't set a pom file here.
 >
 > Good luck!
 >
 > -- Kenney
 >
 >
 >
 >>Hi everyone!
 >>
 >>I just wanted to ask whether there is a clean way to create a new maven
 >>project using the MavenEmbedder API. It is of course possible to
 >>execute the "archetype:create" goal but the API seems to always
 >>require that you already pass in an existing project (at least
 >>an existing pom.xml file) in order to execute any goal.
 >>I think such a feature would be quite handy for other projects
 >>such as the Maven2 Eclipse Plugin.
 >>
 >>Thanks in advance for any help!
 >>
 >>Regards,
 >>   Ovidio
 >>
 >>-
 >>To unsubscribe, e-mail: [EMAIL PROTECTED]
 >>For additional commands, e-mail: [EMAIL PROTECTED]
 >>
 >
 >
 > --
 > Kenney Westerhof
 > http://www.neonics.com
 > GPG public key: http://www.gods.nl/~forge/kenneyw.key
 >
 > -
 > 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]


* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

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 b