• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Generating project from archetype

 
Ranch Hand
Posts: 264
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Everyone,

Just need to know while generating project from a my own archetype, how to put restriction while user enters the artifactId. I require that user could only be able to enter less or equal to 5 character artifactId. otherwise mvn should ask again to enter an artifactId with less than 5 chars.

Thanks
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How about this: "mvn" is a script that runs the JVM to run Maven. Change the script and have it verify the artifact name length before running the JVM. If you don't want to change the mvn script, rename it and supply a new script named mvn which checked the name length and calls the renamed mvn script.

I doubt that there is any way, within Maven itself, to restrict the name length (without writing your own mojo).
 
Pawanpreet Singh
Ranch Hand
Posts: 264
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Peter,

If i need to create my own MOJO for this, should i need to create a new plugin and i need to know that how to extend the functionality of archetype:generate goal of maven-archetype-plugin.

Thanks
reply
    Bookmark Topic Watch Topic
  • New Topic