Last time I checked, Maven Shade did *not* attach the dependency-reduced POM, but that was a while ago and the project I am contributing to uses Maven Assembly. I am certainly going to try again later today or tomorrow when I back at my desk and have access to my computer. I shall report back here, then. Thanks for the hint. :-)
I would still be grateful for other hints, too, ideally also some which work for Assembly or One-JAR, i.e. independently of a specific plugin. Plugin-specific is welcome too, though, because every partial solution can be a step forward or a reason to debate with co-developer to favour one plugin over others. -- Alexander Kriegisch https://scrum-master.de Thomas Broyer schrieb am 25.04.2021 15:05 (GMT +07:00): > Well, maven-shade-plugin does "attach" the dependency-reduced POM: > https://github.com/apache/maven-shade-plugin/blob/768092f38b0b1650217642cf10b7b0c381cbf707/src/main/java/org/apache/maven/plugins/shade/mojo/ShadeMojo.java#L1191 > At least when you install or deployed, that POM gets installed/deployed > rather than the original one. > > Le dim. 25 avr. 2021 à 04:09, Alexander Kriegisch <alexan...@kriegisch.name> > a écrit : > >> I am sorry if I am asking a question the answer to which might be obious >> to others, but for a long time I have wondered why I do not find any >> examples for the following use case which IMO is probably quite common: >> >> ** I build an uber JAR containing some module dependencies, possibly >> also transitive ones. This could be done using Maven Shade or Maven >> Assembly, maybe even something with nested JARs like One-JAR. >> ** The built uber JAR replaces the module's original artifact when >> installed and/or deployed. >> ** By default, the original POM gets attached to the build. This is >> undesirable, because the uber JAR no longer depends on those >> dependencies. They are only needed in the POM during the build as >> such in order to be able to include them in the uber JAR at all. >> >> My question: How do I automatically create and attach a >> dependency-reduced POM to the build, replacing the original POM? >> Ideally, I would have options to also filter out other POM elements such >> as repositories, but that is optional and not the main scope of this >> question. >> >> Presently, I use Flatten Maven Plugin for this purpose. For certain >> reasons, I am not very happy with it because it requires extra work, it >> mutilates my POMs with regard to formatting and removing things I do not >> wish to be removed, but it works. >> >> I also know that Maven Shade automatically creates a dependency-reduced >> POM if not told otherwise. But that POM is not attached to the build. >> Maybe I could do so using Build Helper, but both Flatten Maven and Build >> Helper seem like crutches, and I cannot help but wonder which built-in >> Maven functionality escaped my attention so far. Is there a canonical >> way to do that, such as resource filtering? Can I even apply that to >> POMs? I feel like I might be doing something phenomenally stupid, >> possibly missing a more straightforward way of solving this problem. >> >> -- >> Alexander Kriegisch >> https://scrum-master.de >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org >> For additional commands, e-mail: users-h...@maven.apache.org >> >> > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org