• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Doubt in `-DarchetypeVersion` in `mvn archetype:generate` command

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Team,

i need your help to understand the query posted below

i have a bunch of java projects that have to be migrated to maven projects. I have to automate this process.

I came across `mvn archetype:generate` , I read about it and this would help me in the migration process.

i found the `mvn archetype:generate` command in this website

i executed the command `mvn archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DarchetypeArtifactId=maven-archetype-archetype -DarchetypeVersion=1.4` in my laptop , it generated the maven archetype project successfully.

-DarchetypeVersion=1.4 --- I want to know if 1.4 is the latest version. PFA screenshot shows my generated pom.xml . I don't see version1.4 in the pom.xml , where can I find it in the project which I generated using the `mvn archetype:generate` command ? if i change 1.4 to some other version, then where in the generated project should i verify if that version is installed correctly?


Please help me to understand this. Thank you


Regards,
Divine
zzzzz.png
[Thumbnail for zzzzz.png]
 
Sheriff
Posts: 22787
131
Eclipse IDE Spring Chrome Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch!

The archetypeVersion you're giving is not the version of your project, but that of the maven-archetype-archetype archetype. You can find its available versions at https://mvnrepository.com/artifact/org.apache.maven.archetypes/maven-archetype-archetype or https://central.sonatype.com/search?q=maven-archetype-archetype.
 
divine chelladurai
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you. where can i see this version in the generated project?

Rob Spoor wrote:Welcome to the Ranch!

The archetypeVersion you're giving is not the version of your project, but that of the maven-archetype-archetype archetype. You can find its available versions at https://mvnrepository.com/artifact/org.apache.maven.archetypes/maven-archetype-archetype or https://central.sonatype.com/search?q=maven-archetype-archetype.

 
Saloon Keeper
Posts: 27886
198
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Something that might be useful to know: You can create your own archetypes. if you have a common form to projects in your shop, you can take a project, strip it down to the common parts and catalog it as an archetype. You are not limited to just the archetypes that come from the Maven repository!
 
divine chelladurai
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for the response.
The DarchetypeVersion=1.4 , dependency was released on 2018,  and the generated pom.xml with this version has <maven.compiler.source>1.7</maven.compiler.source>  . i'm concerned about using this command as it points to java7

My plan is to use the archetype project (i will be adding few files that should be present in the generated project) to generate multiple maven projects and it has to be compatible with java 1.8
Please let me know if i can go ahead this approach or is there any better approach. Kindly help


Tim Holloway wrote:Something that might be useful to know: You can create your own archetypes. if you have a common form to projects in your shop, you can take a project, strip it down to the common parts and catalog it as an archetype. You are not limited to just the archetypes that come from the Maven repository!

 
Rob Spoor
Sheriff
Posts: 22787
131
Eclipse IDE Spring Chrome Java Windows
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

divine chelladurai wrote:Thank you. where can i see this version in the generated project?


That information is not present in the generated project, because it doesn't matter - the generated project is completely cut off from the archetype as soon as it's created.

In your case it's probably best to create your own archetype. I've done that for my own projects (private, not visible) from scratch, but maybe you can start with the existing archetype. It's available at https://github.com/apache/maven-archetypes/tree/master/maven-archetype-archetype.
 
It's a beautiful day in this neighborhood - Fred Rogers. Tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic