Re: Multi-module archetypes
Hi John, This feature is provided by the 2.0-alpha-3 version of the Archetype plugin. This version is not yet released. But you can try the last snapshot by adding a repository to apache snapshot [1]. 1. The goal to call from the project directory (or parent in case of a multi module) is 'mvn archetype:create-from-project'. 2. Then go to the target/generated-sources/archetype directory and see if the generated archetype is correct. install the archetype in your local repository by calling 'mvn install' as usual. 3. Then go to a fresh directory and call 'mvn archetype:generate -DarchetypeCatalog=local'. Step 3 may don't work because repositories defined in profiles in the settings.xml file are recognised only when maven is called in a project's directory. One may try to use the apache's snapshot repository as mirror of central (not tested). Another workaround i see is compiling the plugin from the sources. Please share your experience of using the plugin afterward. Thanks, Raphaël [1]: in settings.xml : apache-snapshots apache-snapshot Apache Snapshots false never warn always warn http://people.apache.org/maven-snapshot-repository/ default apache-snapshot Apache Snapshots false never warn always warn http://people.apache.org/maven-snapshot-repository/ default 2008/3/28, Prystash,John <[EMAIL PROTECTED]>: > > I'm stepping into my first foray into creating archeyptes. In general, > is there support for creating an archetype for a multi-module project? > Or is better to build a project with multiple archetypes? My first > thought would be I'd have problem injecting the parent project name into > the directory structure? > > MyService > MyService-core > MyService-container > > Thanks >
RE: Multi-module archetypes
Hey Raphaël, I added the settings to my settings.xml as you described and ran archetype:create-from-project. The POM file referenced 2.0-alpha-2. $ mvn -P apache-snapshots archetype:create-from-project $ cat target/generated-sources/archetype/pom.xml ... 1.0-SNAPSHOT org.apache.maven.archetype archetype-packaging 2.0-alpha-2 maven-archetype-plugin 2.0-alpha-2 true So I added the following to my parent POM, and the resulting POM under target/generated-sources/archetype had 2.0-alpha-3 in them. ... ... org.apache.maven.archetype archetype-packaging 2.0-alpha-3-SNAPSHOT ... maven-archetype-plugin 2.0-alpha-3-SNAPSHOT true ... ... Unfortunately, I now get the following error when rerunning archetype:create-from-project: ... [INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'. [INFO] Setting property: velocimacro.messages.on => 'false'. [INFO] Setting property: resource.loader => 'classpath'. [INFO] Setting property: resource.manager.logwhenfound => 'false'. [INFO] [ERROR] FATAL ERROR [INFO] [INFO] org/apache/commons/lang/StringUtils [INFO] [INFO] Trace java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils at org.apache.velocity.runtime.resource.ResourceManagerImpl.initialize(ResourceManagerImpl.java:165) at org.apache.velocity.runtime.RuntimeInstance.initializeResourceManager(RuntimeInstance.java:594) at org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:241) at org.apache.velocity.app.VelocityEngine.init(VelocityEngine.java:116) at org.codehaus.plexus.velocity.DefaultVelocityComponent.initialize(DefaultVelocityComponent.java:79) ... I tried including commons-lang in POMs to see if that would help, but no luck. Thanks -Original Message- From: Raphaël Piéroni [mailto:[EMAIL PROTECTED] Sent: Friday, March 28, 2008 3:40 PM To: Maven Users List Subject: Re: Multi-module archetypes Hi John, This feature is provided by the 2.0-alpha-3 version of the Archetype plugin. This version is not yet released. But you can try the last snapshot by adding a repository to apache snapshot [1]. 1. The goal to call from the project directory (or parent in case of a multi module) is 'mvn archetype:create-from-project'. 2. Then go to the target/generated-sources/archetype directory and see if the generated archetype is correct. install the archetype in your local repository by calling 'mvn install' as usual. 3. Then go to a fresh directory and call 'mvn archetype:generate -DarchetypeCatalog=local'. Step 3 may don't work because repositories defined in profiles in the settings.xml file are recognised only when maven is called in a project's directory. One may try to use the apache's snapshot repository as mirror of central (not tested). Another workaround i see is compiling the plugin from the sources. Please share your experience of using the plugin afterward. Thanks, Raphaël [1]: in settings.xml : apache-snapshots apache-snapshot Apache Snapshots false never warn always warn http://people.apache.org/maven-snapshot-repository/ default apache-snapshot Apache Snapshots false never warn always warn http://people.apache.org/maven-snapshot-repository/ default 2008/3/28, Prystash,John <[EMAIL PROTECTED]>: > > I'm stepping into my first foray into creating archeyptes. In > general, is there support for creating an archetype for a multi-module > project? > Or is better to build a project with multiple archetypes? My first > thought would be I'd have problem injecting the parent project name > into the directory structure? > > MyService > MyService-cor
RE: Multi-module archetypes
Did you ever figure out what was wrong here? I'm running into the same issue now with the alpha-3 plugin. Prystash,John wrote: > > > Hey Raphaël, I added the settings to my settings.xml as you described and > ran archetype:create-from-project. The POM file referenced 2.0-alpha-2. > > $ mvn -P apache-snapshots archetype:create-from-project > > $ cat target/generated-sources/archetype/pom.xml > > > ... > 1.0-SNAPSHOT > > > > org.apache.maven.archetype > archetype-packaging > 2.0-alpha-2 > > > > > maven-archetype-plugin > 2.0-alpha-2 > true > > > > > > So I added the following to my parent POM, and the resulting POM under > target/generated-sources/archetype had 2.0-alpha-3 in them. > > ... > > ... > > > org.apache.maven.archetype > archetype-packaging > 2.0-alpha-3-SNAPSHOT > > > ... > > maven-archetype-plugin > 2.0-alpha-3-SNAPSHOT > true > > ... > > ... > > Unfortunately, I now get the following error when rerunning > archetype:create-from-project: > > ... > [INFO] Setting property: classpath.resource.loader.class => > 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'. > [INFO] Setting property: velocimacro.messages.on => 'false'. > [INFO] Setting property: resource.loader => 'classpath'. > [INFO] Setting property: resource.manager.logwhenfound => 'false'. > [INFO] > > [ERROR] FATAL ERROR > [INFO] > > [INFO] org/apache/commons/lang/StringUtils > [INFO] > > [INFO] Trace > java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils > at > org.apache.velocity.runtime.resource.ResourceManagerImpl.initialize(ResourceManagerImpl.java:165) > at > org.apache.velocity.runtime.RuntimeInstance.initializeResourceManager(RuntimeInstance.java:594) > at > org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:241) > at > org.apache.velocity.app.VelocityEngine.init(VelocityEngine.java:116) > at > org.codehaus.plexus.velocity.DefaultVelocityComponent.initialize(DefaultVelocityComponent.java:79) > ... > > I tried including commons-lang in POMs to see if that would help, but no > luck. > Thanks > > -Original Message- > From: Raphaël Piéroni [mailto:[EMAIL PROTECTED] > Sent: Friday, March 28, 2008 3:40 PM > To: Maven Users List > Subject: Re: Multi-module archetypes > > Hi John, > > This feature is provided by the 2.0-alpha-3 version of the Archetype > plugin. This version is not yet released. > But you can try the last snapshot by adding a repository to apache > snapshot [1]. > > 1. The goal to call from the project directory (or parent in case of a > multi module) is 'mvn archetype:create-from-project'. > 2. Then go to the target/generated-sources/archetype directory and see if > the generated archetype is correct. > install the archetype in your local repository by calling 'mvn install' as > usual. > 3. Then go to a fresh directory and call 'mvn archetype:generate > -DarchetypeCatalog=local'. > > Step 3 may don't work because repositories defined in profiles in the > settings.xml file are recognised only when maven is called in a project's > directory. One may try to use the apache's snapshot repository as mirror > of central (not tested). > > Another workaround i see is compiling the plugin from the sources. > > Please share your experience of using the plugin afterward. > > Thanks, > > Raphaël > > [1]: in settings.xml : > > apache-snapshots > > > apache-snapshot > Apache Snapshots > > false > never > warn > > > always > warn > > > http://people.apache.org/maven-snapshot-repository/ > default > > > > > apache-snapshot >
RE: Multi-module archetypes
I did just now and things look a lot better. I followed the original instructions from Raphaël below. The archetype was created and I was able to generate instance of the archetype that built out of the box. I noticed a couple of things, one the 's in the POMs still had the old values, but I could of easily changed those before installing the archetype. Each (the parent and two children) in the project I generated the archetype from started with ${rootArtifactId}, as in: [INFO] Scanning for projects... [INFO] Reactor build order: [INFO] MyService [INFO] MyService-core [INFO] MyService-mule I think the archetype plugin could have recognized that, but maybe not should have, so it might not be a real issue, as that's how things were named in this case and obviously isn't universal. I would just see myself having to go in there and change them everytime I would want to install a new version, but that's minor compared to what I'm getting for free essentially. The generated archetype removed the package names (in my case, that match the project groupId) ./target/classes/archetype-resources/__rootArtifactId__-mule/src/test/groovy/Something.groovy Instead of maybe: ./target/classes/archetype-resources/__rootArtifactId__-mule/src/test/groovy/__rootGroupId__/Something.groovy I'm not sure if __rootGroupId__ is the correct substitution and all, but I'm sure you get what I'm trying to say. These also could be completely expected and appropriate behavior, so not a complaint. But when I generated my project instance from the archetype, I got the packaging type in the path for my sources, 'jar' in this case: ./TestService-mule/src/main/groovy/jar/Something.groovy Is that expected behavior, I'm no archetype expert. Overall, this is pretty great, thanks. -Original Message- From: MikeKey [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 30, 2008 9:42 PM To: users@maven.apache.org Subject: RE: Multi-module archetypes Did you ever figure out what was wrong here? I'm running into the same issue now with the alpha-3 plugin. Prystash,John wrote: > > > Hey Raphaël, I added the settings to my settings.xml as you described > and ran archetype:create-from-project. The POM file referenced 2.0-alpha-2. > > $ mvn -P apache-snapshots archetype:create-from-project > > $ cat target/generated-sources/archetype/pom.xml > > ... > 1.0-SNAPSHOT > > > > org.apache.maven.archetype > archetype-packaging > 2.0-alpha-2 > > > > > maven-archetype-plugin > 2.0-alpha-2 > true > > > > > > So I added the following to my parent POM, and the resulting POM under > target/generated-sources/archetype had 2.0-alpha-3 in them. > > ... > > ... > > > org.apache.maven.archetype > archetype-packaging > 2.0-alpha-3-SNAPSHOT > > > ... > > maven-archetype-plugin > 2.0-alpha-3-SNAPSHOT > true > > ... > > ... > > Unfortunately, I now get the following error when rerunning > archetype:create-from-project: > > ... > [INFO] Setting property: classpath.resource.loader.class => > 'org.codehaus.plexus.velocity.ContextClassLoaderResourceLoader'. > [INFO] Setting property: velocimacro.messages.on => 'false'. > [INFO] Setting property: resource.loader => 'classpath'. > [INFO] Setting property: resource.manager.logwhenfound => 'false'. > [INFO] > -- > -- > [ERROR] FATAL ERROR > [INFO] > -- > -- [INFO] org/apache/commons/lang/StringUtils > [INFO] > -- > -- > [INFO] Trace > java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils > at > org.apache.velocity.runtime.resource.ResourceManagerImpl.initialize(ResourceManagerImpl.java:165) > at > org.apache.velocity.runtime.RuntimeInstance.initializeResourceManager(RuntimeInstance.java:594) > at > org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:241) > at > org.apache.velocity.app.VelocityEngine.init(VelocityEngine.java:116) > at > org.codehaus.plexus.velocity.DefaultVelocityComponent.initialize(Defau > ltVelocityComponent.java:79) > ... > > I tried including commons-lang in POMs to see if that would help, but > no luck. > Thanks > > -Original Message- > From: Raphaël
Re: Multi Module Archetypes
I think Apache Cocoon and MyFaces have archetypes that do this, you could reference their code otherwise, try executing "archetype:create-from-project" at the root and see what happens? On Wed, Jun 2, 2010 at 11:47 AM, wrote: > Hi, > > Is it possible to create an Archetype which will create a full multi > module project rather than creating each module individually? > > I would like to generate the following in one go to reduce complexity. > > --parent > warproject > --src > --pom.xml > ejbproject > --src > --pom.xml > earproject > --pom.xml > > Many Thanks > > Chris > > > > - > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > >