Maven and Archetype - maven

Is it possible to create own own project structure ( Archetype) i also like to add some dynamic files to be created.
What steps involved to create it?

You can use the Maven Archetype Plugin to do this. You could use the create-from-project goal to create an archetype from an existing project and then modify this archetype so it fits your needs. You will find all details on the project site.

I have written a tutorial on maven archetypes. This tutorial builds an archetype from the ground for Maven 3.x and demonstrates:
required / optional properties
dynamic files
integration tests
archetype usage
There is also finished code for the tutorial archetype on github:

Related

create gradle multimodule project for AEM using lazybones templates

I had heard of lazybones, which is a command line tool for project creation and it is more interactive or customizable than Maven Archetypes. Thus, I created a maven multimodule aem project using lazybones.
The Command and template for AEM multimodule project is:
lazybones create aem-multimodule-project <target-folder>
This creates a maven multimodule project for AEM. Then, I tried to find the same for Gradle, but I didn't find any template regarding that.
Can anyone give me any direction how can I achieve the same.
Please consider using gradle aem plugin. It has a lot of features and might be good for your case
https://github.com/Cognifide/gradle-aem-plugin

How to create a maven Archetype from an existing archetype

Is it possible to create an application specific archetypes using an existing 'Generic' archetype?.
Generic Archetype - would contain the generic folders and config files etc. Extend the existing archetype to the child archetype.
Generic Archetype ---> Specific App Archetype (Keep app specific folders..)
Generic Archetype ---> Specific App Archetype 1
Every time when we create a project using application specific archetype should check for new updates in Generic archetype.
For me, you have two main choices :
You can create your own archetype from nothing. Here is the official guide. You have few steps to follow (create a pom.xml, an archetype.xml,...).
You can create an archetype from an existing project folder. For example, first, you can create a project from a Maven archetype (like "maven-archetype-webapp") of a web application. Then, you make your changes (add or modify some configuration files, create a folder for a specific purpose, etc.). And finally, you can create you own archetype, from this project, executing this command line :
mvn archetype:create-from-project
A mini guide to create an archetype from a existing project.
Reference doc to create an archetype from a existing project (mojo infos)

how to generate .exe file using maven for RCP plugin project

I have created one RCP Plugin project and converted it into maven project.
I have to generate .exe file for this project using maven.
The problem is that this RCP project not have main method.
Please share how to to do this.
See the tutorials at the Code & Me blog. They take you from the basics of building a single plugin with Maven Tycho to building more complex artifacts such as products (which include the .exe), update sites and the like.

Can maven create a project from a war file?

I want to create a adobe flex blazeds project. How can I create the project using the blazeds.war as the project template ?
war -> maven
you can't do that, there's no way maven can guess how the war was produced only by analyzing the result
generating a project stub for blazeds
that you can do. You can used a defined archetype like this one: http://code.google.com/p/maven-blazeds-spring-archetype/
it will force you to stick to the technology (spring) chosen by the archetype developer, however.

How do I chain different archetypes together?

Is it possible to somehow chain archetypes together by some super-archetype in Maven?
For example I have an archetype create a multi-module project setup.
One of these module projects should be created by another archetype. This archetype is not controlled/developed by myself and availible versions change independently of my multi-module archetype.
Therefore is it possible to define some kind of a super-archetype which executes my archetype A creating the full multi-module setup and afterward creating a module by executing another archetype?
If that is not possible - maybe there is another way to achieve this by using some other Maven functionality?
If I understand correctly you could use your archetype to create your multimodule setup but lack the possibiliy to create one of the modules through another archetype. I don't know of a super-archetype but perhaps this approach is helpful:
You could either extend the pom of your archetype or use the goals commandline argument of the generate-goal to fire a second archetype generation (f.e. via the antrun plugin) and embed the result in your multimodule setup. To automate generation for the third-party archetype you can use the individual parameters of the generate goal (again).

Resources