You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Scott Seiter <sc...@gmail.com> on 2006/09/21 00:58:41 UTC

[m2] Simplifying Archetype Plugin Command Line Arguments

I've created archetypes for different project types and am looking for a
method of creating a new project without having to type in all the extra
arguments (as in):

 

archetype:create -DartifactId=user-guide
-DgroupId=com.mergere.mvnbook.proficio
-DarchetypeArtifactId=maven-archetype-site-simple

 

Clearly I could use a batch job/shell script to avoid the arguments, but I'd
like to make it easy for all our developers to do this without having to
distribute a set of scripts.  The initial thought is to create a plugin that
feeds parameters to the archetype plugin.  

 

Using this mythical plugin, creating a web project could be done by typing
something like:

 

mvn myplugin:new-web myWebProject

 

Has anyone done something like this?  If so, how do you call a plugin from
another plugin.  I noticed Maven 1 had a 'caller' plugin but one page said
this wasn't needed in Maven 2.  Any suggestions?

 

Thanks in advance!

 

Scott

 

 

 

 


Re: [m2] Simplifying Archetype Plugin Command Line Arguments

Posted by franz see <fr...@gmail.com>.


Max Cooper wrote:
> 
> Since you will need to communicate what commands to run to the 
> developers anyway, it doesn't seem like that much of a burden to have 
> the commands be somewhat complex.
> 
> Developers, please run:
>    mvn myplugin:new-web (-Dname.of.new.project=)myWebProject
> 
> ...is not really much different from...
> 
> Developers, please run:
>    mvn archetype:create -DartifactId=user-guide \
>    -DgroupId=com.mergere.mvnbook.proficio \
>    -DarchetypeArtifactId=maven-archetype-site-simple
> 
> 
> In my opinion, having the developers run the full commands is 
> preferable. You don't have to create, maintain, and distribute a plugin, 
> and the developers get some exposure to "real" Maven. For instance, it 
> is very likely that your developers will need to install 3rd party jars 
> in a team repository or in their local repositories, which are commands 
> that require many command line arguments. It probably doesn't make sense 
> to hide this complexity from your developers. We expect carpenters to be 
> able to use saws and hammers; we should expect developers to be able to 
> use the tools of their trade (build tools, version control, etc.).
> 
> -Max
> 
> Scott Seiter wrote:
>> I've created archetypes for different project types and am looking for a
>> method of creating a new project without having to type in all the extra
>> arguments (as in):
>> 
>>  
>> 
>> archetype:create -DartifactId=user-guide
>> -DgroupId=com.mergere.mvnbook.proficio
>> -DarchetypeArtifactId=maven-archetype-site-simple
>> 
>>  
>> 
>> Clearly I could use a batch job/shell script to avoid the arguments, but
>> I'd
>> like to make it easy for all our developers to do this without having to
>> distribute a set of scripts.  The initial thought is to create a plugin
>> that
>> feeds parameters to the archetype plugin.  
>> 
>>  
>> 
>> Using this mythical plugin, creating a web project could be done by
>> typing
>> something like:
>> 
>>  
>> 
>> mvn myplugin:new-web myWebProject
>> 
>>  
>> 
>> Has anyone done something like this?  If so, how do you call a plugin
>> from
>> another plugin.  I noticed Maven 1 had a 'caller' plugin but one page
>> said
>> this wasn't needed in Maven 2.  Any suggestions?
>> 
>>  
>> 
>> Thanks in advance!
>> 
>>  
>> 
>> Scott
>> 
>>  
>> 
>>  
>> 
>>  
>> 
>>  
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 
> 

Good day to you, Scott,

I agree with Max. Furthermore, archetypes are not usually called several
times in a project since it just creates the skeleton (with some defaults)
and that's it. Thus, you may be trying to improve something that does not
happen that often. 

But if you really want to, you can try to use MavenEmbedder to call
archetype and feed in some parameters. Rahul Thakur recently posted
something like this at a previous user inquiry ([1]).

But probably, the most basic way for you to accomplish what you want is to
simply create your own version of the maven-archetype-plugin wherein the
only thing different is the version, and the defaults of the expressions.

Cheers,
Franz

[1] http://www.nabble.com/forum/ViewPost.jtp?post=4602520&framed=y
-- 
View this message in context: http://www.nabble.com/-m2--Simplifying-Archetype-Plugin-Command-Line-Arguments-tf2308674.html#a6420175
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: [m2] Simplifying Archetype Plugin Command Line Arguments

Posted by Max Cooper <ma...@maxcooper.com>.
Since you will need to communicate what commands to run to the 
developers anyway, it doesn't seem like that much of a burden to have 
the commands be somewhat complex.

Developers, please run:
   mvn myplugin:new-web (-Dname.of.new.project=)myWebProject

...is not really much different from...

Developers, please run:
   mvn archetype:create -DartifactId=user-guide \
   -DgroupId=com.mergere.mvnbook.proficio \
   -DarchetypeArtifactId=maven-archetype-site-simple


In my opinion, having the developers run the full commands is 
preferable. You don't have to create, maintain, and distribute a plugin, 
and the developers get some exposure to "real" Maven. For instance, it 
is very likely that your developers will need to install 3rd party jars 
in a team repository or in their local repositories, which are commands 
that require many command line arguments. It probably doesn't make sense 
to hide this complexity from your developers. We expect carpenters to be 
able to use saws and hammers; we should expect developers to be able to 
use the tools of their trade (build tools, version control, etc.).

-Max

Scott Seiter wrote:
> I've created archetypes for different project types and am looking for a
> method of creating a new project without having to type in all the extra
> arguments (as in):
> 
>  
> 
> archetype:create -DartifactId=user-guide
> -DgroupId=com.mergere.mvnbook.proficio
> -DarchetypeArtifactId=maven-archetype-site-simple
> 
>  
> 
> Clearly I could use a batch job/shell script to avoid the arguments, but I'd
> like to make it easy for all our developers to do this without having to
> distribute a set of scripts.  The initial thought is to create a plugin that
> feeds parameters to the archetype plugin.  
> 
>  
> 
> Using this mythical plugin, creating a web project could be done by typing
> something like:
> 
>  
> 
> mvn myplugin:new-web myWebProject
> 
>  
> 
> Has anyone done something like this?  If so, how do you call a plugin from
> another plugin.  I noticed Maven 1 had a 'caller' plugin but one page said
> this wasn't needed in Maven 2.  Any suggestions?
> 
>  
> 
> Thanks in advance!
> 
>  
> 
> Scott
> 
>  
> 
>  
> 
>  
> 
>  
> 
> 

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


Re: [m2] Simplifying Archetype Plugin Command Line Arguments

Posted by Wendy Smoak <ws...@gmail.com>.
On 9/20/06, Scott Seiter <sc...@gmail.com> wrote:

> Using this mythical plugin, creating a web project could be done by typing
> something like:

Not quite what you're asking for, but Don Brown wrote Archy, a utility
that pulls a list of archetypes form the MAVENUSER wiki, and prompts
for the parameters:

http://docs.codehaus.org/display/MAVENUSER/Archetypes+List
---> https://www.twdata.org/projects/archy

-- 
Wendy

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