Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should this use case supported ? #605

Closed
sbernard31 opened this issue Jun 23, 2022 · 2 comments
Closed

Should this use case supported ? #605

sbernard31 opened this issue Jun 23, 2022 · 2 comments

Comments

@sbernard31
Copy link

sbernard31 commented Jun 23, 2022

I recently change my project maven structure to something like this. (eclipse-leshan/leshan#1271)


 ┌──────────────┐
 │  Aggregator  │◄───────────────────────┐
 │              │                        │
 │ ┌──────────┐ │                        │
 │ │ Module A1├─┼──┐                     │
 │ └──────────┘ │  │      ┌──────────┐   │
 │              │  ├─────►│ Parent A │   │
 │ ┌──────────┐ │  │      └─────┬────┘   │
 │ │ Module A2├─┼──┘            │        │
 │ └──────────┘ │        ┌──────▼──────┐ │
 │              │        │ Super Parent├─┘
 │ ┌──────────┐ │        └──────▲──────┘
 │ │ Module B1├─┼───┐           │
 │ └──────────┘ │   │     ┌─────┴────┐
 │              │   ├────►│ Parent B │
 │ ┌──────────┐ │   │     └──────────┘
 │ │ Module B2├─┼───┘
 │ └──────────┘ │
 │              │
 └──────────────┘
 
 
C ─► P : means that P is parent of C (inheritance)
  
┌───────┐
│  ┌───┐│
│A │ M ││  : means that A aggregates module M (aggregation) 
│  └───┘│
└───────┘

   

(done with https://asciiflow.com)

Difference between Aggegation and inheritance.

All my maven workflow seems to work as I expected, except that now I'm not able anymore to change version easily with version-maven-plugin

When I launch the versions:set goal on the agregator this only change versions of the aggregator this doesn't change child modules or parents one.

mvn versions:set -DnewVersion=2.0.0-M8 -DprocessDependencies=false -DprocessPlugins=false -DartifactId='*'
(also tested with processAllModules=true)

(groupid is the same for all module)

Is it supposed to be supported ?

(Eventually my project is available at https://github.com/eclipse/leshan/tree/build_config , be sure you are using the build_config branch, If needed I can create a more simple project to reproduce)

@sbernard31
Copy link
Author

My mistake, I wanted to use the parent pom as shared config and not add it as child of my aggregator.
Because, In my case there is no sense to build parent as they share configuration.

But it seems that this is not really what I am supposed to do with maven, I just discover that all parent pom should be deliver too. So I should I add my parent A, B and super parent as child module of aggregator.

I still don't get what is the clean way to factorize maven build configuration 🤷 , I feel maybe inheritance chosen by Maven was not the best choice.

So my question does not make sense.

@sbernard31
Copy link
Author

Finally, my use case is maybe not that stupid.

I just discover that all parent pom should be deliver too.

This ☝️ is not so true, see : https://stackoverflow.com/questions/58521838/how-to-deploy-child-module-without-also-deploying-parent-module/72830959#72830959

And I finally find a solution to use versions-maven-plugin, with my use case, I create a new profile that I call allPom which adds parent A, parent B and super parent as child module.

I need to use this profile only when I want to update version : mvn versions:set -DnewVersion=1.0.0 -PallPom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant