Using WSO2 Carbon Component Archetype which has been published to maven central, you can create a simple Carbon Component with one command.
Eg:
mvn archetype:generate -DarchetypeGroupId=org.wso2.carbon -DarchetypeArtifactId=org.wso2.carbon.archetypes.component -DarchetypeVersion=5.0.0 -DgroupId=org.sample -DartifactId=org.sample.project -Dversion=1.0.0 -Dpackage=org.sample.project
Above command will create a Carbon Component with the following structure.
org.sample.project
├── pom.xml
└── src
└── main
└── java
└── org
└── sample
└── project
├── GreeterImpl.java
├── Greeter.java
└── internal
├── DataHolder.java
└── ServiceComponent.java
If you do not pass the parameters for the project then the default values will be applied.
You can find the source for this archetype here.