Let’s say in a multi-module project, each module is created by different teams, but each module is important for the project to work.
Each team should have its own module code, while other modules should appear in jar form.
Even when working through this git, they don’t have to see modifications in module codes that don’t belong to them.
But to test the project on the whole team, all the modules need to be used together.
I can do a multi-module project through maven, but when I put it on git, do I have to put each module in a separate repository?
how to they will find out what other module is in the new version in the version update of the modules?
You need to decide:
Will these modules always be built and tested together?
If yes: Put them into one git repository and use a multi-module structure. Everyone will checkout everything, but make changes only for their module.
If no: Separate the project in two or more multi-module projects in separate git repositories.
Related
I'm writing a lot of plugins for minecraft bukkit server's and I've grown tired of copy+pasting the same utility classes in my projects all over again. I decided to just put them all in a separate project and add them to my plugins via maven. I'm using IntelliJ Ultimate.
I want to have a maven project that contains all my utitily classes called e.g. UtilityAPI. Then I want to be able to create another project, which will be my bukkit plugin. In this second project I want to be able to use all the code from the first one. Also, I'd like it very much, that if I choose to build a plugin jar, maven automatically takes into account the most recent code from my API-Project.
I started working on this and started reading about maven modules and how you can use them to forge different projects together. I initially thought, that this was just what I needed, and tried to just add
<modules>
<module>UtilityAPI</module>
</modules>
However this results in my bukkit plugin project being considered a parent project, and refuses to build in a jar, but just in a (at least for me) rather useless .pom file. I'm not sure how to proceed. Do I have to create a "parent" project for my bukkit plugin project which contains the api and the plugin project as modules? And if yes, how do I generate a .jar, and not a .pom?
The dream solution would be to have the UtilityAPI project, and being able to include it in any new plugins that I might write in the future. I'd also be a fan of having a simple way to create a jar with the newest sources of my plugin in it. Is this possible, and if yes, how?
In your Maven multi-module project your plugin would have to be another module (and not the parent, which has packaging type pom). This module would then have a dependency on the API module (dependencies between modules are possible).
However, multi-module projects are usually intended for projects which are tightly coupled. That does not appear to be the case for your scenario. It sounds like the plugins have (potentially) nothing in common except for the dependency on the API project. Maybe it would be better to have the API project as separate standalone Maven project and then deploy snapshot versions of it (or install them only to your local Maven repository) and use these in your plugin projects.
Hi I am converting a ear project to Maven. Below is the structure
-projA-ear
-projA-static
-projA-web
-shared-util
The shared util is shared by multiple unrelated projects handled by our team. Currently my deployment assembly is handled by eclipse and the shared-util.jar is automatically built inside the projA-web.war's WEB-INF/lib directory
When I convert my setup to Maven project, I am reading that I need multi module aggregator setup, and need to define shared-util as a module, and then define the aggregator POM as the parent to my modules. The problem is I cannot define projA-mvn as parent in the shared-util project as the other projects would be using it too as a module(when they decide to move to maven). Can someone please suggest a solution?
1) Make shared-util as a separate standalone Maven project.
2) Put projA-ear, projA-web and projA-static under a separate parent Maven project.
3) Declare shared-util jar as a dependency in your projA-web pom.
How can i combine two maven projects. One is webapp, and other is some javascript library (also webapp) which i want to combine with others project.
Or, would be better, how to add some outside folder with js files to maven project that can be deployed on testing server and then build to war.
Have a look at overlays in the Maven WAR Plugin documentation. This explains how Maven merges resources from different web projects into a single WAR.
In a nutshell, you create several WAR files of all the dependencies (usually, you already have this but you can even do this if they aren't real working web projects). Then you can pull these in as dependencies. The important part here is to specify the type of the dependency (<type>war</type>); otherwise Maven will try to add the JAR.
The WAR plugin will notice the additional WARs in the list of dependencies and merge them.
You can create One parent project and Two modul project. You will have 3 pom.xml files.
modul projects extendens dependencies from parent project. Maven parent pom vs modules pom, Multimodule project
Maven WAR Overlays could solve the problem. If you have two maven web projects, and one of your Web Project depends on the other's you could declare the dependent project as a dependency and do an overlay.
Reference:
http://maven.apache.org/plugins/maven-war-plugin/overlays.html
I want create skeleton for big ecommerce project. It will be huge project. It should be a core module and set of additional modules.
Now I am thinking about maven modules into Spring MVC project. But I am newbie in maven and Spring
How make each module independent from other modules? Any best practice?
Any examples or code snippets?
I have a multi-module Maven project which was created couple of months back.
I can give you some pointers.
It can be structured as a parent project and multiple child modules under it.
In my case the output generated with Maven is a .war file and which contains jar files from each child module.
From maven you can build each modules separately if you want.
This is a useful link for multi-module creation
http://skillshared.blogspot.in/2012/11/how-to-create-multi-module-project-with.html
These are the layers on a high level:
Bean > Service > DAO [JPA]
Another useful link on directory structure is
Maven Multi Module Project Structuring Issues
I have a Maven web project (Java) that I created in Eclipse. Due to in house IDE restriction I had to move the project to JDeveloper 12c and disable the Maven nature. I had to make several tweaks to project's properties in JDeveloper to make it work.
We found that the back-end code (Service Impl, DAO and Entity classes) can be used on several other projects so we are evaluating/considering to separate the single large web project into 2 projects. One for the front end, which is specific for each project and the other for backend, which is common for all projects.
Here are few ways I thought it can done.
1) From the single large web project, create 2 projects; web UI project and web back-end project.
2) Keep the code as it is and use maven modules or maven overlays feature and generate 2 wars from the same code.
I have not dealt with the projects depending on others or multi module projects a lot. Do you see any issues with this type of architecture, good or bad!
Please let me know if you have any other suggestions or ran into similar situations before. Thanks in advance.
Splitting project into many subproject is a good idea. You could use maven multimodule project setup (docs). Every frontend project would have a separate maven project (module in parent pom) and you'll have one project (module) for the backend.
Depending on your requirements you could then create:
an EAR archive with backend in EJB jar and all frontends in WAR archives,
a WAR archive for every frontend project with EJB jar (or jar for non-plain-javaee setup) inside WEB-INF/lib.
Multimodule setup has few advantages and the main one is that you can build the whole application from scratch just by issuing single mvn command.