I am new to maven.
I want to reuse a maven module which is part of a maven git project in another maven git project.
I know how to create a maven module in a maven project but no idea about the best way to copy a maven module from project-1 to project-2(through command line or any ide)
Can you tell me a way to clean copy without adding dependency on project-1. As the main focus is to copy the structure and few class files and need not keep this copied module up to date with the module in project-1
If I'm understanding you correctly, you want to use code from an existing maven sub-module in your new project?
Then why don't you just clone the repository, and simply copy the required classes and paste them into the src folder of your own project?
Note that you may not be allowed to do everything I described here. Pay attention to project-1's license.
All of this should only really be useful if you plan to change the original code to fit your own needs. If you just need to interact with the classes, a dependency really is the best option. Maybe you can tell us more of your plans?
If you're not planning on changing the code in the package, I would advise to put a dependency directly on the third party maven project. There's really not much point in creating your own maven project using a subset of the available code.
If you are hell-bent on using a local subset, then create a new maven project, and simply move the packages that you need to your project's src/main/java folder. Then install and place a dependency on that project. You don't need to create jars yourself.