You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by MikeKey <mi...@gmail.com> on 2008/05/01 03:42:08 UTC

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
> <?xml version="1.0" encoding="UTF-8"?>
> <project>
>   ...
>   <version>1.0-SNAPSHOT</version>
>   <build>
>     <extensions>
>       <extension>
>         <groupId>org.apache.maven.archetype</groupId>
>         <artifactId>archetype-packaging</artifactId>
>         <version>2.0-alpha-2</version>
>       </extension>
>     </extensions>
>     <plugins>
>       <plugin>
>         <artifactId>maven-archetype-plugin</artifactId>
>         <version>2.0-alpha-2</version>
>         <extensions>true</extensions>
>       </plugin>
>     </plugins>
>   </build>
> </project>
> 
> 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.
> 
>     ...
>     <build>
>       ...
> 	<extensions>
>         <extension>
>           <groupId>org.apache.maven.archetype</groupId>
>           <artifactId>archetype-packaging</artifactId>
>           <version>2.0-alpha-3-SNAPSHOT</version>
>         </extension>
>       </extensions>
>       ...
>       <plugin>
>         <artifactId>maven-archetype-plugin</artifactId>
>         <version>2.0-alpha-3-SNAPSHOT</version>
>         <extensions>true</extensions>
>       </plugin> 
>       ...
>     </build>
>     ...
> 
> 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:raphaelpieroni@gmail.com] 
> 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 :
>         <profile>
>             <id>apache-snapshots</id>
>             <repositories>
>                 <repository>
>                     <id>apache-snapshot</id>
>                     <name>Apache Snapshots</name>
>                     <releases>
>                         <enabled>false</enabled>
>                         <updatePolicy>never</updatePolicy>
>                         <checksumPolicy>warn</checksumPolicy>
>                     </releases>
>                     <snapshots>
>                         <updatePolicy>always</updatePolicy>
>                         <checksumPolicy>warn</checksumPolicy>
>                     </snapshots>
> 
> <url>http://people.apache.org/maven-snapshot-repository/</url>
>                     <layout>default</layout>
>                 </repository>
>             </repositories>
>             <pluginRepositories>
>                 <pluginRepository>
>                     <id>apache-snapshot</id>
>                     <name>Apache Snapshots</name>
>                     <releases>
>                         <enabled>false</enabled>
>                         <updatePolicy>never</updatePolicy>
>                         <checksumPolicy>warn</checksumPolicy>
>                     </releases>
>                     <snapshots>
>                         <updatePolicy>always</updatePolicy>
>                         <checksumPolicy>warn</checksumPolicy>
>                     </snapshots>
> 
> <url>http://people.apache.org/maven-snapshot-repository/</url>
>                     <layout>default</layout>
>                 </pluginRepository>
>             </pluginRepositories>
>         </profile>
> 
> 
> 2008/3/28, Prystash,John <pr...@oclc.org>:
>>
>>  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
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Multi-module-archetypes-tp16354720s177p16992786.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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


RE: Multi-module archetypes

Posted by "Prystash,John" <pr...@oclc.org>.

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 <name/>'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:mike.key@gmail.com] 
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
> <?xml version="1.0" encoding="UTF-8"?> <project>
>   ...
>   <version>1.0-SNAPSHOT</version>
>   <build>
>     <extensions>
>       <extension>
>         <groupId>org.apache.maven.archetype</groupId>
>         <artifactId>archetype-packaging</artifactId>
>         <version>2.0-alpha-2</version>
>       </extension>
>     </extensions>
>     <plugins>
>       <plugin>
>         <artifactId>maven-archetype-plugin</artifactId>
>         <version>2.0-alpha-2</version>
>         <extensions>true</extensions>
>       </plugin>
>     </plugins>
>   </build>
> </project>
> 
> 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.
> 
>     ...
>     <build>
>       ...
> 	<extensions>
>         <extension>
>           <groupId>org.apache.maven.archetype</groupId>
>           <artifactId>archetype-packaging</artifactId>
>           <version>2.0-alpha-3-SNAPSHOT</version>
>         </extension>
>       </extensions>
>       ...
>       <plugin>
>         <artifactId>maven-archetype-plugin</artifactId>
>         <version>2.0-alpha-3-SNAPSHOT</version>
>         <extensions>true</extensions>
>       </plugin> 
>       ...
>     </build>
>     ...
> 
> 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 Piéroni [mailto:raphaelpieroni@gmail.com]
> 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 :
>         <profile>
>             <id>apache-snapshots</id>
>             <repositories>
>                 <repository>
>                     <id>apache-snapshot</id>
>                     <name>Apache Snapshots</name>
>                     <releases>
>                         <enabled>false</enabled>
>                         <updatePolicy>never</updatePolicy>
>                         <checksumPolicy>warn</checksumPolicy>
>                     </releases>
>                     <snapshots>
>                         <updatePolicy>always</updatePolicy>
>                         <checksumPolicy>warn</checksumPolicy>
>                     </snapshots>
> 
> <url>http://people.apache.org/maven-snapshot-repository/</url>
>                     <layout>default</layout>
>                 </repository>
>             </repositories>
>             <pluginRepositories>
>                 <pluginRepository>
>                     <id>apache-snapshot</id>
>                     <name>Apache Snapshots</name>
>                     <releases>
>                         <enabled>false</enabled>
>                         <updatePolicy>never</updatePolicy>
>                         <checksumPolicy>warn</checksumPolicy>
>                     </releases>
>                     <snapshots>
>                         <updatePolicy>always</updatePolicy>
>                         <checksumPolicy>warn</checksumPolicy>
>                     </snapshots>
> 
> <url>http://people.apache.org/maven-snapshot-repository/</url>
>                     <layout>default</layout>
>                 </pluginRepository>
>             </pluginRepositories>
>         </profile>
> 
> 
> 2008/3/28, Prystash,John <pr...@oclc.org>:
>>
>>  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
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

--
View this message in context: http://www.nabble.com/Multi-module-archetypes-tp16354720s177p16992786.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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




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